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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Carry value over to tabbed subforms

Status
Not open for further replies.

Accesser

Technical User
Jun 3, 2002
44
US
Howdy,

I'm trying to carry over a value in a textbox in the main form to textboxes (with different names) in subforms placed on tabbed pages. The form/subforms are not linked on that particular field.

Default value doesn't work in this case because it only deals with new records and messes with the joins. Also, in this case, the values Must be included in the different underlying tables.

Isn't there an easy way to say...if a user enters a new record in the mainform and tabs to a subform on another page, make the subform textbox value = mainform textox value.

Thanks much.
 
If the first field on the subform is different than the field that you want to "carry the value over from the main form", then you could put code in the After Update event of that first field.

The code could populate the other field with the value from the main form - me.otherFieldName = forms!frmMainFormName.fieldname

This is kind of confusing, so if it does not make sense let me know what the field names are on each form so I can use those in my explanation.

Jennifer
 
Thanks Jennifer!

The main form fields are DocAlpha and DocNo. The corresponding fields in the subform (tabbed page 2) are PartyDocAlpha and PartyDocNo. Values in these fields in the subform should be autofilled with the values in the main form when a user clicks on a command button on the main form to switch to page 2--or when a user clicks on the tab at the top of page 2.
 
Is DocNo the Primary Key?
Is PartyDocNo the Primary Key?
 
Actually, the primary key(s) are other fields. I have a many-to-many relationship set up involving 2 tables: tblDocumentData (prikey=DocumentDataID {AutoNumber Field}) and tblPartyData (prikey=PartyDataID), and the join table is tblDocumentPartyDetail (prikey=DocPartyDetailID and foreign keys DocumentDataID and PartyDataID). Basically, I'm making a document info database, where 1 or more parties can refer to 1 or more documents, and vice-versa. I guess one of my problems is that I'm not too familiar with many-to-many joins ;-)

Anyway, to answer your question, the DocAlpha and PartyDocAlpha and DocNo and PartyDocNo fields are not primary/foreign to each other. And, the fields should exist within both tables for now for QA/QC purposes. This won't increase the size of the dbase much.

Your help is much appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top