where condition in a filter

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

I need to apply a filter where only records with a particular UserID are
displayed. I have a combo box called FindUser and a refresh button. When
the button is clicked, several things happen but the one I am having trouble
with is the userid filter. The field in my query and on my continuous form
is 'UserID'


Can you tell me what I am doing wrong in my syntax:

If Not [FindUser] = "" Then
DoCmd.ApplyFilter , "userID = [FindUser]"
End If


I have also tried:

If Not [FindUser] = "" Then
DoCmd.ApplyFilter , "userID = me.FindUser"
End If

and:

If Not [FindUser] = "" Then
DoCmd.ApplyFilter , userID = FindUser
End If
 
Try leaving [Finduser] out of the quotes:

DoCmd.ApplyFilter , "userID =" & me.[FindUser]

If Userid is text then the value must be wrapped in quotes:

DoCmd.ApplyFilter , "userID =""" & me.[FindUser] & """"
 
Back
Top