+ Reply to Thread
Results 1 to 5 of 5

LIKE not working with wildcard in MS Query

  1. #1
    Registered User
    Join Date
    06-28-2013
    Location
    Fort Mill, SC
    MS-Off Ver
    Excel 2010
    Posts
    17

    LIKE not working with wildcard in MS Query

    Hi All,

    I'm having trouble getting a wildcard to work in my query. This table connects to an Access database with ODBC and the queries are entered through MS Query. Here's the query:

    Please Login or Register  to view this content.
    In the LIKE parameter, I'm trying to pass the value along in a variable defined through a UserForm. If I select, say, 2013, then it changes the LIKE to LIKE '2013' and it works fine. However, when I select *, it evidently passes the parameter on but then it does not return any records. If I go into the MS Query application then the same thing happens. However, if I do it in Access, it works fine and returns the correct records.

    What's going on here?

    edit: Also, here's the code in VBA

    Please Login or Register  to view this content.
    Last edited by RollerRagerMD; 07-03-2013 at 08:48 AM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,574
    % is the wildcard not *.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    06-28-2013
    Location
    Fort Mill, SC
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: LIKE not working with wildcard in MS Query

    I thought * was the wildcard for Access? Either way, it seems neither one works in MS Query. I don't think % worked for me in Access either, only *.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,574
    Yes * is the wildcard for Access, but % is the wildcard for MS Query.

    If it's not working for you why not remove the WHERE clause if * has been entered/selected in the userform?

    PS What's the field type of the field you are setting the criteria for?

  5. #5
    Registered User
    Join Date
    06-28-2013
    Location
    Fort Mill, SC
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: LIKE not working with wildcard in MS Query

    It's a Text field type. And now it seems % is working... don't ask me how or why but it is, haha. Thank you for the help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1