two combo boxes

loki

Registered User.
Local time
Today, 10:37
Joined
May 4, 2001
Messages
58
I have one combo boxes that draws from a table to list all departments. My second combo box draws from another table to list all tasks involved with all the departments. How can I do it so that the second combo box will look through the table and only list the tasks related to the department that was picked in the first combo box. (Every task has an id that relates it to a certain department.)
 
Loki,

The easiest way is to reset the 2nd combobox's rowsource after the first one is updated. Try something like;

Private Sub cbo_Dept_ID_AfterUpdate()

Dim strSQL as String
strSQL = "SELECT Tasks " & _
"FROM tbl_Tasks " & _
"WHERE Task_ID = '" & Me.cbo_Dept_ID & "'"
Me.cbo_Tasks.RowSource = strSQL

End Sub

I often leave the 2nd combobox's row source blank when the form is opened. This way the user has to select an option from the first box to have options in the 2nd. This comes in handy with large tables as the form loads quicker.

Jon
 

Users who are viewing this thread

Back
Top Bottom