Results 1 to 3 of 3
  1. #1
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296

    Instr ignores first character?

    I have a bunch of data that starts with "22P" yet when I type the following into a criteria for queries


    Code:
    Instr(1,[field],"22P") > 0
    It returns no results. Yet if i search for "2P" it shows them all.
    I know you can't tell it to start with 0 because that produces an error but what am I doing wrong?

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    works for me?

    Code:
    tt= "2322P"
    ? instr(1,tt,"22P") 
     3 
    
    tt= "22P"
    ? instr(1,tt,"22P") 
     1
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Vita's Avatar
    Vita is offline Competent Performer
    Windows 10 Access 2002
    Join Date
    May 2022
    Location
    Massachusetts, USA
    Posts
    296
    Quote Originally Posted by Welshgasman View Post
    works for me?

    Code:
    tt= "2322P"
    ? instr(1,tt,"22P") 
     3 
    
    tt= "22P"
    ? instr(1,tt,"22P") 
     1
    I was being dumb and checking to see if it was over 1 haha. Changed it to 0 and it works.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 11-09-2022, 09:33 AM
  2. Replies: 18
    Last Post: 10-11-2017, 03:07 PM
  3. Replies: 2
    Last Post: 04-07-2016, 07:19 AM
  4. Replies: 3
    Last Post: 01-30-2015, 11:34 AM
  5. Counter that ignores duplicates?
    By athyeh in forum Programming
    Replies: 2
    Last Post: 09-20-2013, 01:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums