Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Instr function question (97)

    Instr function question
    I picked up the below to help me run a query that would allow me to enter more than one value for a parameter.

    InStr([Event number separated by commas],[EventNumber]) the query also has a criteria that it should be greater than zero.

    When I run this query though, the result is not an exact result. If I enter event 34, I get event 34 as well as 3 and 4.

    What is wrong?

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Instr function question (97)

    Instr is a string function.
    Convert your numbers to string:

    InStr(Cstr([Event number separated by commas]),Cstr([EventNumber])) > 0
    Francois

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Instr function question (97)

    Instr just gives the position of one string in another string, so clearly if the first string is "87,34,51" you'll find "34" as well as "3" and "4" (as well as others).

    You'll need to search for delimiters as well. For instance, if the first string was ",87,34,51," you could unambiguously search for ",34," .

Posting Permissions

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