Select record from a subform to display on the main form

S

Sammie

I have a main form bound to tblVendors with a subform bound to tblContacts.
How can the user select one record from the subform, bring it to the main
form, and have it remain there every time the record on tblVendors is opened
until the user changes the subform record selection?

The subform has the following fields: contactname, phone, fax, email. I
want all four of these fields to be brought to the main form.
 
B

boblarson

I think you are misunderstanding what a subform is for. USUALLY, a subform
is used to display the many side of a one-to-many relationship. So, in other
words, it is used to display all records on the many side that are related to
the record currently selected on the main form.

So, in your case you are saying that the subform is just holding unrelated
data to the main form but you want to use the data from that to put in the
main form.

I, personally would use a list box instead for this, but you can set a
double-click event to insert fields from the currently selected record on the
subform to the currently selected record on the main form by simply using:

With Me
.Parent.YourTextBoxOnMainForm = .YourSubformTextBox1
.Parent.YourTextBox2OnMainForm = .YourSubformTextBox2
.Parent.YourTextBox3OnMainForm = .YourSubformTextBox3
End With

etc.

--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
If my post was helpful to you, please rate the post.
__________________________________
 

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