View Full Version : combo box / linking


RpbertS
05-01-2000, 09:03 AM
hi,
I have a table that stores a project name and the subprojects of that project, they are both primary keys. in the table they look like this
----------
proj1 sub1
proj1 sub2
etc.
----------
my question is this on a form there are 2 combo boxes next to each other one holds the project and one holds the subproject how would I only show the subprojects that are associated with the project in the first combo box?

thanks for the time,
Rpb

Carol
05-01-2000, 01:05 PM
Once the project gets selected, then you would have the combo box requeried to reflect only the subprojects connected to the main project. On the On Enter of your subprojects combo box, include this Event Procedure:
Private Sub SubProjects_Enter()
On Error GoTo SubProjects_Enter_Err

DoCmd.Requery "MainProject"


SubProjects_Enter_Exit:
Exit Sub

SubProjects_Enter_Err:
MsgBox Error$
Resume SubProjects_Enter_Exit

End Sub

Change the names used to reflect your combo box names.

Good luck.