How to use like function when you prompt an Enter Value in a query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Stevestan
    New Member
    • Jul 2010
    • 13

    How to use like function when you prompt an Enter Value in a query

    I have a query that prompts you to enter a value so that it can match that value with a table column. I currently use the [] symbols to do this. I would like to combine this function with the like funciton so that a user does not have to enter an exact match to get a result. I have tried using [**], *[]*, and like [], but those do not return like results. Any help is appreciated!
  • gershwyn
    New Member
    • Feb 2010
    • 122

    #2
    Put the following in the criteria line of the query for the field you are searching:

    Code:
    LIKE "*" & [Search For:] & "*"
    You can change the prompt within the [] to whatever you like. That should return everything that contains what the user entered.

    Comment

    • thelonelyghost
      New Member
      • Jun 2010
      • 109

      #3
      How are you matching things? What's the setup?

      I've designed my own search-form where it creates a string of SQL and sets it as a Record Source. It also applies to Row Source, etc. that can use a SQL SELECT statement.

      Look at the source code HERE for one method of doing so.

      Comment

      • Stevestan
        New Member
        • Jul 2010
        • 13

        #4
        Tried what gershymn wrote right after I posted and it did what I intented it to do. On a side note, does anybody know how to center the text or have 2 lines of text in the prompt window?

        Comment

        Working...