p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access VBA (http://p2p.wrox.com/forumdisplay.php?f=80)
-   -   Linking an unbound subform (http://p2p.wrox.com/showthread.php?t=47680)

probitaille September 11th, 2006 08:05 PM

Linking an unbound subform
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.

mmcdonal September 13th, 2006 12:27 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:

And the txtCode field in the query would have this criteria:

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?


All times are GMT -4. The time now is 07:26 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.