Subject: Linking an unbound subform
Posted By: probitaille Post Date: 9/11/2006 8:05:24 PM
I know this is probably not the best plan, but I need to link an unbound subform to some values contained in a listbox selection on the main form. The reason why I am using an unbound subform is that I want to control how the user adds/edits/navigates the records (using proper command controls).

I would like to link the subform programmatically to the main form (or the values selected in the list box). Based on the list box selection (and the values of Column(0) and Column(3)), the subform should be populated with the records from a table (tblOptions) containing fields with values equal to Column(0) and Column(3) (on the subform, it corresponds to txtExecID and txtCode).

I am currently doing this in DAO; I tried a few different things but none work.

Reply By: mmcdonal Reply Date: 9/13/2006 12:27:53 PM
Don't quote me, but I think a Master/Child link on a form/subform will only take one column.

Double click the subform in design view and select the data tab, then select the Master and Child fields you want to use.

You alternative is to code this OR use a query with criteria that look to the controls on your main form.

So the query behind your subform with have this as criteria for txtExecID:
[Forms]![frmMainFormName].[txtExecID]

And the txtCode field in the query would have this criteria:
[Forms]![frmMainFormName].[txtCode]

For both of these, they may be referencing columns in the text box or combo box you are using.

The thing is, doing it this way means that only records that satisfy both field values will be returned.

Do you have more info?




mmcdonal

Go to topic 49234

Return to index page 176
Return to index page 175
Return to index page 174
Return to index page 173
Return to index page 172
Return to index page 171
Return to index page 170
Return to index page 169
Return to index page 168
Return to index page 167