linking a combo box in a form to a sub form

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

How do I create a combo box in a main form that I can use
for navigation and selecting what records I want in a sub
form instead of using the navigation buttons at the bottom
of the form
 
If you want to use the combo to select which records are available in the
subform, just enter the name of the combo into the subform contol's
LinkMasterFields property, with the matching (foreign key) field name in the
LinkChildFields property.

If the subform has nothing in its LinkMasterFields/LinkChildFields, you
could use the code in this link:
http://allenbrowne.com/ser-03.html
replacing all occurances of:
Me
with:
Me.[NameOfYourSubformControlHere].Form

If the records in the subform do change every time the main form moves
record, and you want the combo to be loaded with the same records, you will
need to use the Current event of the main form to reassign the RowSource of
the combo. Build a SQL statement as a string, with the WHERE clause
reflecting the value if the field(s) named in the LinkMasterFields.
 
thanks

-----Original Message-----
If you want to use the combo to select which records are available in the
subform, just enter the name of the combo into the subform contol's
LinkMasterFields property, with the matching (foreign key) field name in the
LinkChildFields property.

If the subform has nothing in its
LinkMasterFields/LinkChildFields, you
could use the code in this link:
http://allenbrowne.com/ser-03.html
replacing all occurances of:
Me
with:
Me.[NameOfYourSubformControlHere].Form

If the records in the subform do change every time the main form moves
record, and you want the combo to be loaded with the same records, you will
need to use the Current event of the main form to reassign the RowSource of
the combo. Build a SQL statement as a string, with the WHERE clause
reflecting the value if the field(s) named in the LinkMasterFields.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

steve said:
How do I create a combo box in a main form that I can use
for navigation and selecting what records I want in a sub
form instead of using the navigation buttons at the bottom
of the form


.
 
Back
Top