Push values from bound form to undound, edit, then pull back

D

Dickie Black

Hi,

I've seen answers to similar questions, but none of them quite work. I have
a main bound form with various bound controls. I wish to be able to click a
button which will do the following:

open another (unbound) form
populate with some of the values from the main form, so they can be edited
close the new form
transfer the edited values back.

I know about "DoCmd.OpenForm, "MyForm", , , , , acDialog " to pause the
code until the new form is hidden, but how do I then tell the new form to
use values from the main form?

If I try

Forms.SessionDesc.SessionDescText = Forms.[Session test].SessionDescText
Forms.SessionDesc.SessionPrimary = Forms.[Session
test].PrimaryLecturerText
Forms.SessionDesc.SessionSecondary = Forms.[Session
test].SecondaryLecturerText

I get "Object doesn't support this property or method" errors, whether this
code is in the OnClick event of the button, or the Form_Current event of the
unbound form.

I'm sure it's something relatively simple I'm missing...

Dickie
 
D

Dickie Black

Thanks, I knew it would be something that simple!

Dickie

Elwin said:
you should be using exclamations to separate your object
names, not periods.
eg) Forms!SessionDesc!SessionDescText

Periods preceed a method or property name that has been
assigned by Access. Exclamations preceed an object name
that has been assigned by the user.
eg) Forms!SessionDesc.Requery

Good luck.
-----Original Message-----
Hi,

I've seen answers to similar questions, but none of them quite work. I have
a main bound form with various bound controls. I wish to be able to click a
button which will do the following:

open another (unbound) form
populate with some of the values from the main form, so they can be edited
close the new form
transfer the edited values back.

I know about "DoCmd.OpenForm, "MyForm", , , , , acDialog " to pause the
code until the new form is hidden, but how do I then tell the new form to
use values from the main form?

If I try

Forms.SessionDesc.SessionDescText = Forms.[Session test].SessionDescText
Forms.SessionDesc.SessionPrimary = Forms.[Session
test].PrimaryLecturerText
Forms.SessionDesc.SessionSecondary = Forms.[Session
test].SecondaryLecturerText

I get "Object doesn't support this property or method" errors, whether this
code is in the OnClick event of the button, or the Form_Current event of the
unbound form.

I'm sure it's something relatively simple I'm missing...

Dickie


.
 
J

John Vinson

Forms.SessionDesc.SessionDescText = Forms.[Session test].SessionDescText

Use ! instead of . - it's confusing because they will both *often*
work interchangably but they're not quite interchangable. The ! refers
to an item in a collection (such as the Forms collection, or the
Controls collection of a form), and that's what you need here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top