S
Sam Kuo
(Last post didn't seem success. My apology if double-post occurs)
The code below filters records only after BOTH cboState and cboCity have been
selected. But how can I amend it so the records can be first filtered right
after
cboState selection is made, then if the users prefer, they can filter the
records further using cboCity?
--- start of my code ---
Private Sub cboState_AfterUpdate()
' Filter the list of cboCity under selected State
Me.cboCity.RowSource = "SELECT City FROM" & _
" qryDomesticOffices WHERE State = """ & Me.cboState & """ " & _
" ORDER BY City"
Me.cboCity = Me.cboCity.ItemData(0)
End Sub
Private Sub cboCity_AfterUpdate()
' Filter records under selected State and City
DoCmd.ApplyFilter , "City = '" & cboCity & "'"
End Sub
--- end of my code ---
The code below filters records only after BOTH cboState and cboCity have been
selected. But how can I amend it so the records can be first filtered right
after
cboState selection is made, then if the users prefer, they can filter the
records further using cboCity?
--- start of my code ---
Private Sub cboState_AfterUpdate()
' Filter the list of cboCity under selected State
Me.cboCity.RowSource = "SELECT City FROM" & _
" qryDomesticOffices WHERE State = """ & Me.cboState & """ " & _
" ORDER BY City"
Me.cboCity = Me.cboCity.ItemData(0)
End Sub
Private Sub cboCity_AfterUpdate()
' Filter records under selected State and City
DoCmd.ApplyFilter , "City = '" & cboCity & "'"
End Sub
--- end of my code ---