Copy Data From Main To Sub Form

B

Bonnie A

Hi everyone! Using A02 on XP. I have a main form [ICSUpgrade2008MainForm]
with some data on it that I would like to copy down to my subform
[ICSUpgrade2008SubForm] when I click a button on the subform. The Main Form
field is: [Forms]![ICSUpgrade2008MainForm]![Trustee] and the Sub Form field
is [Forms]![ICSUpgrade2008SubForm]![ContactName]. I want to copy the name
from [Trustee] to [ContactName].

I've played with me.contactname = and can't figure out the mainform field.
Do I have to create an unbound field on my subform to = the mainform field
and copy that way? Seems a bit cumbersome.

I'd like to learn the best way to do this rather than something sloppy I
might come up with.

Thanks in advance for your time and help.
 
N

Naeem Azizian

Here how to do it:
in your subform, on the button onclick event:

Dim TextBoxValue As Variant

TextBoxValue = Me.Parent.Form!Trustee.Value

Me.ContactName = TextBoxValue

That's it!
 

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