• Wildcard as text (Access 2000)

    Author
    Topic
    #369522

    I have data that resides on a database where the * forms part of a text string.

    How can i get my query to search for the exact string “19830817*001” without access treating the * as a wildcard???

    Viewing 2 reply threads
    Author
    Replies
    • #581980

      If you use
      [MyField] Like “19830817*001”
      the * will be treated as wildcard.
      If you use
      [MyField] = “19830817*001”
      the * will be treated as literal

    • #581982

      Hi,
      In addition to Francois answer, if you want to search for a string that contains one of the wildcard characters, you can enclose the wildcard in square brackets:
      e.g. Like “123[*]*” would search for anything which started with “123*”.
      Hope that helps.

      • #582002

        OK – I’ve tested the Like (19830817[*]001″) and it works perfectly, BUT (there’s ALWAYS a but), I couldn’t get it to do multiple events.

        For example, I wish to pick up “19830817*001” and “19800923*001”

        Correction – i can get it to do

        Like (“19830817[*]001”) Or Like (“19800923[*]001”)

        but not using the IN function

        Thanks,
        John

        • #582004

          Hi,
          The IN operator should work the same way as the equals function – i.e. it will do an exact match so you shouldn’t need the square brackets in that situation.
          Hope that helps.

        • #582044

          If the * is always in the same place, the following will work:

          Like (‘198?????[*]*’)

    • #581987

      As an example, a field in your table contain three records as follows:

      19830817*001
      198*5612
      200*25645

      You want a query that will only return the 198*5612. The following statement will do this:
      Like (“198[*]*”)
      The * in [*] is treated literally as a character instead of a wildcard.

    Viewing 2 reply threads
    Reply To: Wildcard as text (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: