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!

multiple sub forms in Microsoft access

Status
Not open for further replies.

chrisgarvey

Technical User
Mar 27, 2003
64
GB
Hello,

I have a main form with a field called client ID, this is linked to a sub form which also contains the field Client ID. This works fine

I now want to link a field in this sub form to a field in another sub form. (although this field is not contained in the original form)

Is this possible?

Thanks for your time.
 
Give name to your subforms like child1 , child2 ...

suppose you have main form were client ID field is the same as client ID field in child1, you can easily linked both of them now if u want to link your child1 form with the child2, then in the child2 form properties you need to mention the field name which is same in the child1, then in the link Master field property defined
[Child1].Form![fieldname]

hope this will help you.
 
Chris,

Its not only possible, but a powerful way of keeping related forms synchronised.

The way I do it is as follows:

(a) Assume that you have a main form called frmMain, which contains two subforms frmMainSub1 and frmMainSub2. Lets further assume that the link field between these two subforms is called Sub1Sub2Link, and that this field exists in both subforms.

(b) create a text control on the MAIN form; also call it Sub1Sub2Link .... set its ControlSource property to "=frmMainSub1.Form!Sub1Sub2Link" ... dont include the quotes but DO include the equal symbol. This new text control on the main form will now be syncronised to the first subform's Sub1Sub2Link control's value.

(c) When you're happy that the above works, make the above text control not visible( ie. set its visible property to false) - you can do this step anytime.

(d) Now simply set the LinkChild and LinkMaster fields on the second subform to "txtSub1Sub2" (no quotes) respectively.

(e) The master link on the second subform should now sync with the computed main form control which is synced to the first subform.

(f) Hope this makes sense. In case you're wondering about why bother with the intermediate computed control on the main form ... well if memory serves me correctly, you do need it if you you wish to sync more than two levels of subforms at a time - also very useful and powerful to do sometimes (eg. to select a customer which in turn selects his list of invoices which in turn syncs to the invoice lines of the first invoice etc.

Food for thought ... hope this helps,

Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
cheers steve!

Thats a great explanation.

Thanks for your help.

chris garvey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top