Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy value from one subform to another

Status
Not open for further replies.

gauntletxg

Technical User
Jun 24, 2007
8
US
Hi everyone. Hopefully someone can help me out here, I'm stumped.

I have a main form that contains basic client information. There are then three subforms that contain specific contact information (i.e one subform is for a business contact, another is for a technical contact, etc. etc.)

I want to have a button next to the last 2 subforms that will copy over all of the data from the first subform. This would save a lot of data entry time, as about 50% of the time the business and technical contact person are the same. This way I could click a button in these instances, instead of typing in the same information twice.

I've done something similar with copying a value from a form to a subform, but I can't get this to work. This is what I have right now (I'm just testing on one field until I get it working)

Forms!frmContact.tblContactBusSubForm.cuBusName.Value = Forms!frmContact.tblContactInvSubForm.cuInvName.Value

frmContact = this is my main form
tblContactBusSubForm = first subform
tblContactInvSubForm = second subform

This code returns a "object doesn't support this property/method" error.

Any ideas?

Thanks a bunch.
 
when referencing a value in the subform you have to return a reference to

the form
the subform control
the form within the subform control
the control on the subform

so it probably is

Forms!frmContact.tblContactBusSubForm.form.cuBusName.Value

the .form returns the form within the subform control

You could also normalize your tables.
You could have a table with contact information. Normally contact information is one to many, but your buisness rules create a many to many. Then a junction table something like

tblCompany_Contact
companyID_fk
contactID_fk
contactType

so if john has an ID of 1 and Jane has an ID of 6, and John and Hane work for company 2. If John is a technical and buisness, and Jane is the Personnel contact.

2 1 Technical
2 1 Buisness
2 6 Technical
 
Should be
2 1 Technical
2 1 Buisness
2 6 Personnel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top