Results 1 to 9 of 9
  1. #1
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328

    Filter with wildcard

    I can't seem to do the simple feat of filtering with a wildcard. I have a combo box in a continuous form's header. The user may modify the full combo box selection as wished.



    What I am trying to achieve is: OnUpdate, if the combo box displays "Sm", I would like the form to filter for smith, smythe, smolen etc. The last I tried was Form.Filter = "[lname]='" Like "*" & Me.FF & "*" & "'"

    Must be simple, but I have tried all the "Like" expressions I can find on this site and elsewhere and am going nuts missing something. Using A2007 with W7. Any help appreciated.

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Try
    "[lname]= Like " & Me.FF & "*"

  3. #3
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328
    HI - I tried Form.Filter = "[lname]= Like " & Me.FF & "*" per suggestion, but I get error message as follows: Run Time error no 3075 Syntax error(missing operator) in query expression 'Lname= like sm*'. Is it my computer?

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    No. It's the fact that I had on my Concept hat and not my Syntax hat.
    Form.Filter = "[lname]= Like """ & Me.FF & "*"""

  5. #5
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by gg80 View Post
    HI - I tried Form.Filter = "[lname]= Like " & Me.FF & "*" per suggestion, but I get error message as follows: Run Time error no 3075 Syntax error(missing operator) in query expression 'Lname= like sm*'. Is it my computer?
    take out the equal sign "=" and add single quote before the quote sign after "like" and single quote after the "*"

    "[lname] Like '" & Me.FF & "*'"

  6. #6
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Guess I picked up the wrong hat again. =/

  7. #7
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328
    Thanks everybody. If it weren't for this superior forum, I might commit hari-kari. This now works- I won't even try the one with asterisks in front for a while. Why do these expressions have to be so non-intuitive? Thanks again.

  8. #8
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    compared to other programming language, VB/VBA is VERY simple.

    Also, I believe it's called harakiri or seppuku.

  9. #9
    gg80 is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Jul 2010
    Posts
    328
    I stand corrected. The only other programming I did, before Gates was born, was regular basic. As I remember it, very intuitive.

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

Similar Threads

  1. If OR statement (maybe a wildcard?)
    By Lorlai in forum Queries
    Replies: 5
    Last Post: 07-27-2011, 10:21 AM
  2. Deleting Tables With Wildcard?
    By orcinus in forum Programming
    Replies: 2
    Last Post: 06-20-2011, 10:48 AM
  3. replace a character with a wildcard
    By neeedhelp in forum Programming
    Replies: 2
    Last Post: 04-11-2011, 05:02 PM
  4. SQL wildcard character excluding
    By sandlucky in forum Access
    Replies: 2
    Last Post: 03-28-2011, 03:33 AM
  5. Parameter Query & Wildcard
    By Rick West in forum Queries
    Replies: 8
    Last Post: 12-29-2009, 10:54 AM

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