Results 1 to 4 of 4
  1. #1
    WendellS is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    10

    Filter a form by macro

    They should be so simple but it's not working for me



    I have a Form called employeesearch
    It has 3 fields "id", "lastn","firstn"

    I have a text box called "text39"
    I have a button attached to a macro

    Macro:
    Setfilter
    Filter name = {this is blank}
    Where condition= [lastn] like "*" & [text39] & "*"
    Control Name ={this is blank}

    I just want to type the last name in the text39 box and filter the form by the macro

    What am I doing wrong? Thanks for the help

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    What happens - error message, wrong results, nothing?

    Try:

    Where condition= [lastn] like "*" & Forms!employeesearch![text39] & "*"
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    WendellS is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Aug 2016
    Posts
    10
    Yes I should have told you that also. I just typed in your example and basically it's coming up asking me to enter a parameter Value box. (If I type the name again I this box it works ) I typed "smith" in the text box and I clicked the macro button to run the macro and it comes up asking me to enter the parameter.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    The suggested syntax works for me.

    Access is not finding anything named [text39].
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 5
    Last Post: 12-01-2016, 02:22 PM
  2. Replies: 2
    Last Post: 06-17-2015, 12:20 PM
  3. Macro to apply filter to form
    By mattzkn in forum Macros
    Replies: 3
    Last Post: 12-11-2013, 12:57 AM
  4. Replies: 1
    Last Post: 04-28-2013, 09:43 PM
  5. MACRO to filter
    By DAE60 in forum Programming
    Replies: 1
    Last Post: 11-13-2012, 02:10 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