Results 1 to 4 of 4
  1. #1
    comfygringo is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    12

    Filter Using VBA


    Why doesn't this work? myUserID is a public variable.

    Private Sub cmdCallback_Click()
    Me.Filter = "[Valid_numbers].[Call Back] = True and [Valid_Numbers].[UserID] = '&myUserID&'"
    Me.FilterOn = True
    End Sub

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Try this:
    Me.Filter = "[Valid_numbers].[Call Back] = True and [Valid_Numbers].[UserID] = '" & myUserID & "'"

  3. #3
    comfygringo is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    12
    Thanks! That worked!

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Great! Glad we could help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Filter By Form and Apply Filter Buttons
    By JustLearning in forum Forms
    Replies: 13
    Last Post: 02-18-2015, 01:01 PM
  2. Replies: 1
    Last Post: 08-16-2012, 01:51 PM
  3. Apply Filter similar to Field Filter
    By DatabaseIntern in forum Forms
    Replies: 1
    Last Post: 06-11-2012, 05:42 PM
  4. Replies: 28
    Last Post: 03-08-2012, 06:47 PM
  5. How to filter dates using an apply filter code.
    By Jgreenfield in forum Reports
    Replies: 4
    Last Post: 11-15-2011, 01:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums