By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,067 Members | 1,283 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,067 IT Pros & Developers. It's quick & easy.

Subform referencing subform

jimleon
P: 74
I know this question has been answered in many ways on this and other forums, but cannot find and anwer that directly refers to my problem.

I have 2 subforms, Clients (which contains client details) and Invoice address. The contents of both form are derived from the table clientDetails. I would like the Invoice address form to reflect the address stored in the clientDetails table referenced by the client in the clients subform. Have tried various way but still have not been able to make it work sucessfully.

Any help would be great people.
Jul 13 '09 #1
Share this Question
Share on Google+
4 Replies


Expert 100+
P: 1,287
When you say referenced by the client in the clients subform, what do you mean exactly? If a record is being selected, you may use the subform's Current event to Filter the other subform, or update a field on the main form, which is used as the Link Master field (which is probably easiest).
Jul 13 '09 #2

jimleon
P: 74
Cool, and how do you do that?
Jul 13 '09 #3

Expert 100+
P: 1,287
Ok here's how I think I would do it. I'm going to make up some field names and stuff, so substitute your own.

Open the main form that contains the 2 subforms in design mode.

Add an unbound text box to your main form called txtSelectedClient.

In the Properties->Events of the Clients subform, find the On Current event, and add an Event Procedure.
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. Forms!MainForm!txtSelectedClient = ClientNumber
  3. End Sub
Now, look at the InvoiceAddress subform properties by clicking the outside edge of the subform, not the little box in the corner. Under the Data tab, you should see Link Master Fields and Link Child Fields.

Set the Link Master Fields to txtSelectedClient, and set the Link Child Fields to ClientNumber, or whatever the name is of the actual field. Now the subform will only show the record that matches what is put in that box when it's selected in the Clients subform.

Once it's working, you can set the visible property of txtSelectedClient to No.
Jul 14 '09 #4

jimleon
P: 74
Thanks Chip, that worked a dream was a bit confused about the Link Master Fields and Link Child Fields but now i know what each does.
Jul 14 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.