Results 1 to 2 of 2

Thread: Instr

  1. #1
    Join Date
    Dec 1969

    Default Instr

    How can prevent<BR><BR>InStr("16,4,7","6") return 2

  2. #2
    J. Paul Schmidt Guest

    Default Numbers in InStr()

    You wrote:<BR>"How can one prevent the following:<BR>InStr("16,4,7", "6") returns 2"<BR><BR>Well of course the answer of 2 is literally correct as 6 is the 2nd character.<BR><BR>But you probably don&#039;t want it to show a match because there is no NUMBER 6 in the first part as the NUMBER is actually 16.<BR><BR>For a workaround that avoids arrays perhaps be sure there is a comma before and after each number. Then search for a comma, a number, and a comma.<BR><BR>For example the following should return 0 for no match instead of 2:<BR>InStr(",16,4,7,", ",6,")<BR> <BR>Best regards,<BR>-Paul<BR><BR>J. Paul Schmidt, MBA<BR>Databases on the Web<BR><BR>

Posting Permissions

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