filtering combo box on form using vba

zar786

Registered User.
Local time
Today, 06:33
Joined
Mar 30, 2005
Messages
11
i have been trying this for a while now, but can't get it to work, i've based the combo box on a query which selects the field i want to be filtered, i've made a command button with the following code on the onclick event:

Code:
Private Sub cmdFilterByStatus_Click()
'filter records by Status
Dim strFilter As String
strFilter = "[status] = " & cboFilterStatus
DoCmd.ApplyFilter , strFilter
End Sub

were [status] is the field on the form i want to filter

Any help much appreciated.
 
I think DoCmd.ApplyFilter requires two arguments. A Name and criteria.

DoCmd.ApplyFilter x, strFilter

You could also use:

me.filter = strFilter
 

Users who are viewing this thread

Back
Top Bottom