simon551
IS-IT--Management
- May 4, 2005
- 249
I tried this code to sort a combobox by another combobox, but when I click the second combobox, I get a popup asking me to enter the parameter which is defined by the first combo box. For example: I choose ManagerID "1" in the first combobox. The pop asks: enter parameter: 1. Then if I enter "1" the query works and my 2nd box is filtered correctly. Has anyone experienced this?
Private Sub cboStore_AfterUpdate()
Dim sManagerSource As String
sManagerSource = "SELECT [tblManager].[lngManagerID], [tblManager].[lngStoreID], [tblManager].[strManagerName] " & _
"FROM tblManager " & _
"WHERE [lngStoreID] = " & Me.cboStore.Value
Me.cboManager.RowSource = sManagerSource
Me.cboManager.Requery
End Sub
Private Sub cboStore_AfterUpdate()
Dim sManagerSource As String
sManagerSource = "SELECT [tblManager].[lngManagerID], [tblManager].[lngStoreID], [tblManager].[strManagerName] " & _
"FROM tblManager " & _
"WHERE [lngStoreID] = " & Me.cboStore.Value
Me.cboManager.RowSource = sManagerSource
Me.cboManager.Requery
End Sub