Results 1 to 2 of 2
Thread: Synchronizing Combo Boxes (2003)
2007-05-16, 13:43 #1
- Join Date
- Nov 2004
- Thanked 0 Times in 0 Posts
Synchronizing Combo Boxes (2003)
Can Combo boxes be synchronized in a subform whose default view is set to datasheet? I am hoping to create two combo boxes: the first will contain a list of departments and the second combo box will list all the employees of that department in a subform in datasheet view. The user will continue to enter data related to the employee in the record.
I've looked at code where they instruct me to create the combo boxes on a separate form. Can this be done? Your assistance is greatly appreciated.
2007-05-16, 13:59 #2
- Join Date
- Mar 2002
- Thanked 30 Times in 30 Posts
Re: Synchronizing Combo Boxes (2003)
Yes, it is possible, but it may not be a good idea.
You can use the standard method for synchronizing combo boxes: set the Row Source property of the second combo box to a query that refers to the first combo box in the criteria for the department column. Requery the second combo box in the After Update event of the first one.
But a continuous or datasheet form has only one set of controls, even though it displays multiple records. So when you requery the row source of the combo box, this affects *all* records, not just the current one. If the combo box is bound to a field, this will cause the combo box to look empty for employees that don't belong to the currently selected department. In a continuous form, you can mask this by putting a text box on top of the second combo box, but you cannot do that in a datasheet form.