Results 1 to 4 of 4

Thread: [Prompt] data as filter for criteria

  1. #1
    Join Date
    Oct 2002
    Location
    Indiana USA
    Posts
    79

    [Prompt] data as filter for criteria

    I want to enter a string expression as criteria for a field, in order to filter the records of a query. I want to create a prompt to allow the user to provide the input. The prompted input will then be a PORTION of the filter expression. OK.
    1. If the prompted input is, in its entirety, the filter expression, that's simple. The expression is simply the prompt inside square brackets.
    e.g. -> [Please enter something]
    Returned will be the records for which the data in the given field matches the input information.
    2. If I want to indicate only a PORTION of the total data to filter for, and I put this portion into the filter, that's also simple.
    e.g. -> Like "*met*"
    will return all records with <met> anywhere in the field, such as Calumet, Metropolitan, New York Mets.
    But I want the combination of these two.
    If I enter -> Like "*[met]*", everything between the ** is treated as mere characters and the brackets' contents are not understood to be prompt text. But *[met]* by itself is invalid syntax.
    So I'm rather stuck.
    Thanks

  2. #2
    Join Date
    Sep 2003
    Location
    in my cube
    Posts
    95
    I have a table named table1. My field in table1 is called [name]. (bad choice, but eh).

    In my query, I create the following field:

    Exists: IIf(InStr(1,[table1].[name],[Enter Something],1)>0,1,0)


    I set the criteria of this field to 1.

    I then include in a column next to that field my [name] field.

    I had as values in my table the following:

    Pizza
    Metropolitan
    New York Mets
    Kismet

    When I entered pi when prompted, the returned result was the row containing "pizza"

  3. #3
    Join Date
    Oct 2002
    Location
    Indiana USA
    Posts
    79
    Hey, is that cool or what!!

  4. #4
    Join Date
    Sep 2003
    Location
    in my cube
    Posts
    95
    Glad it worked

Posting Permissions

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