Problem with dynamic combo boxes in subform

  • Thread starter Thread starter Stephen Haley
  • Start date Start date
S

Stephen Haley

I have a subform which shows the details for the client selected on the
mainform. On the subform are various positions at the client where the user
can select from a list of contacts to assign them to that position. Rather
than show the whole list of contacts in the combo box I would like to
restrict it to just the clients at that contact. Unfortunately I cannot get
the list to refresh when a new client is chosen in the master form. The list
just filters on the client at point of load and then stays static - what am
I doing wrong or is not possible to have a dynamic combo box? I have tried
putting a where condition in the query pointing at the id for the current
client but this only works at load not when you refresh.

rgds
stephen
 
In the AfterUpdate event of the combo box on the main form, issue a Requery
to the combo box on the subform.

Syntax:
Me.NameOfSubformControl.Form.NameOfCombobox.Requery

The name of the subform control may or may not be the same as the name of
the form it holds (the form being used as a subform).
 
Are there no triggers that can be used on the subform - I cant see any being
setoff but that appears crazy?
rgds
stephen
 
If you are just trying to link one combo box to another, then the second
combo's Row Source should be based on a query that will have in its WHERE
clause the value of the first combo as a filter. When you requery the second
combo, the query will once again look at the current value of the first
combo and display the correct information in the drop down list.

If you are wanting to link the two forms together (main form and subform)
then you need to set the Parent/Child field properties of the subform
control to the fields on the two forms that are used for linking them. This
is usually the same field that the two tables feeding the forms are linked
on.
 
Back
Top