Results 1 to 4 of 4
  1. #1
    mrmims is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    53

    Wildcard / TempVar Criteria

    Hello,



    How do I combine the * Wildcard with a TempVar?

    I currently use:

    Code:
    Like "mcc_g1*"
    to find all records beginning with MCC_G1. But now I have over 21 different "MCC" identifications and I don't want to create a different query for each.

    How do I use a tempvar with the Like and * functions?????

    I have tried:

    Code:
    Like [TempVar]![MCC]*
    
    Like ([TempVar]![MCC])*
    
    Like ([TempVars]![MCC] & "*")
    And other variations.

    Any help would very much appreciated!

    Thank you

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    like [Enter the MCC String] & "*"

    if you're using it as a criteria in a query

  3. #3
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Use the * when setting the TempVar itself
    TempVars.Remove("MCC")
    TempVars.Add "MCC","MCC*"))
    use Like TempVars!MCC

  4. #4
    mrmims is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    53
    like [Enter the MCC String] & "*"

    Worked great! Thank you

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

Similar Threads

  1. tempvar update query date field
    By raffi in forum Queries
    Replies: 2
    Last Post: 09-27-2014, 11:51 PM
  2. Replies: 9
    Last Post: 12-05-2013, 11:48 AM
  3. Condition if there is a tempvar
    By Ruegen in forum Programming
    Replies: 1
    Last Post: 11-18-2013, 05:06 PM
  4. Replies: 3
    Last Post: 10-31-2012, 12:50 PM
  5. Problem with a wildcard in a query criteria
    By desk4tbc in forum Programming
    Replies: 1
    Last Post: 08-10-2011, 06:02 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