+ Reply to Thread
Results 1 to 13 of 13

How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

  1. #1
    Registered User
    Join Date
    11-12-2012
    Location
    Jersey City, NJ, USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    Hi,

    I'm trying to help the users of a spreadsheet which was created by my predessor in my current job (who has since returned to India and is unreachable).

    He set up a query from this spreadsheet by following these steps: Data Tab, Get External Data Group, From other Sources, From Microsoft Query. (The query he set up pulls from an Access database, which I maintain). They query by doing right click, refresh, then entering a parameter. Right now the query requires the user to put in the exact value they want to search on. The users want me to alter this query so they can use wildcards in the parameter value they enter.

    I've tried going into Data Tab, Connections, Properties, Details to change the query, but I don't know what to put in as a wildcard character so that the users can enter the first few characters then pull in everything that begins with those characters. (~, ?, and * aren't working, unless I'm using them incorrectly)

    What is the best way to set this up for them

    I very much appreciate any thoughts you have on this.

    Thanks

    Steve

  2. #2
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    You have changed the condition from = value to like value*?

  3. #3
    Registered User
    Join Date
    11-12-2012
    Location
    Jersey City, NJ, USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    Can you give me an example of the syntax I would use for "like value*" ?

    There are about 20 users all using this spreadsheet during the day, each day. Each user will enter a different value when they use the spreadsheet.

    Values are 10-20 length alphanumeric characters/numbers.

    If the user wants to find all values which begin with, for example, a value of DHEC* how would they enter this in the field ? or how would I enter it in the query ?

    Thanks alot, I really appreciate your advice

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,937

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    Your prompt will look like this: Like [Enter first four letters and *]

    Here are the instructions from MS http://office.microsoft.com/en-us/ex...005199548.aspx
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  5. #5
    Registered User
    Join Date
    11-12-2012
    Location
    Jersey City, NJ, USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    OK, I went into connections, Definition, and changed the query to do a Like. Then I go to the spreadsheet which runs it and enter DHEC* and it seems to consider it an exact match and brings back nothing when I know that this value exists in the database.

    This is the query:

    SELECT `Data CitiFin SSB Voice Master`.`Source Master`, `Data CitiFin SSB Voice Master`.source, `Data CitiFin SSB Voice Master`.`Vendor Name`, `Data CitiFin SSB Voice Master`.`Circuit/TN`, `Data CitiFin SSB Voice Master`.`Total Charges`, `Data CitiFin SSB Voice Master`.InvoiceDate, `Data CitiFin SSB Voice Master`.`Circuit Status`, `Data CitiFin SSB Voice Master`.`Expense Code`
    FROM `Data CitiFin SSB Voice Master` `Data CitiFin SSB Voice Master`
    WHERE (`Data CitiFin SSB Voice Master`.`Circuit/TN` like ?)


    I really appreciate the assistance.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,937

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    Look at this visual http://www.*****-clicks.com/excel/ExternalData6.htm

    In the third visual down where they have [Please enter a City], you should type

    Like [Please enter what you wish your users to search for] & "*"

    Inside the square brackets, you may wish to say something similar to Enter first three letters of the record you are searching. This is how it works in Access which uses the same type SQL syntax.

    Alan

    Edit: Look at this thread also. I wonder if wildcards in MS Query are a little different than Access.

    http://www.excelforum.com/excel-prog...parameter.html
    Last edited by alansidman; 11-13-2012 at 12:59 PM.

  7. #7
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    Alan thanks for your assistance.

  8. #8
    Registered User
    Join Date
    11-12-2012
    Location
    Jersey City, NJ, USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    I can't get to the first link, its showing up with dots in this post. For some reason though I am able to get to the second link.

    Ok, so I went into the area where I set a prompt and I put the following into the prompt (without quotes):

    "Please enter the first 3 characters of the circuit id followed by an asterix"

    Then I ran the query, and entered DHE*, which I know exists in the database. It brought back nothing, which I assume is because it was looking for an exact match and didn't find anything looking like "DHEC*" (without the quotes)

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,937

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    The forum software put in the asterisks. insert for the asterisks with out these spaces d i c k s to get to the first link. Didn't realize that was happening. You added the word Like in your prompt? Also not sure if you use asterisks or percent symbols in MS Query. Asterisks in Access. I know other databases use the percent sign. Did you try both?

  10. #10
    Registered User
    Join Date
    11-12-2012
    Location
    Jersey City, NJ, USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    That word was probably blocked by this site because in American English it would be considered innappropriate for an office or professional setting lol.
    The meaning must be different in British usage.

    I did add "like" into my prompt.

    I tried the % sign instead of an * and it gives me an error message

  11. #11
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,937

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    Just for grins, look here: http://en.wikipedia.org/wiki/Spotted_****

    Did it again. You know what to add in place of the asterisks.


    One more idea on the parameter. What happens when you put Like into the prompt and leave off the wildcard.

    Also, look at this:

    http://www.excelforum.com/excel-prog...-wildcard.html

  12. #12
    Registered User
    Join Date
    11-12-2012
    Location
    Jersey City, NJ, USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    I can't put that URL in my browser without getting hauled off to human resources lol. As well as the fact that it woul earn me an image for me that is fine for others who are that way, but id just is not who I am, lol.

    So, I used like [name] = % in my query, as described in the second link, and it brought back everything without asking for the first part of the string.

  13. #13
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,937

    Re: How do I do use a wildcard in a "Microsoft Query" embedded in an excel spreadsheet ?

    One thing that was never explained is where is the data your are trying to query? What type of database? There may be another solution other than MS Query. I just ran across a way to have a parameter query in Access be run directly from Excel with a little bit of VBA.

    Check this out: http://datapigtechnologies.com/blog/...ic-parameters/
    and this: http://datapigtechnologies.com/blog/...ry-from-excel/
    and this: http://datapigtechnologies.com/blog/...re-from-excel/
    and this: http://datapigtechnologies.com/blog/...one-parameter/

    Not sure if any of this will help, but I am still intrigued.

    Alan

    Alan

+ 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