PDA

View Full Version : Do not understand method instr



msa969
06-02-2010, 12:20 PM
I am using this code in an login table for staff and have this validation code:
InStr([Password],"password")=0

But I do not fully understand what the method InStr is doing, like what is the return value of method Instr? Any help will help. Thank you

CreganTur
06-02-2010, 12:42 PM
What exactly are you trying to accomplish? The code you provided and explination don't really make sense. Just write out, in detail, what you are hoping to accomplish and we'll be able to provide some help.

msa969
06-02-2010, 02:14 PM
What exactly are you trying to accomplish? The code you provided and explination don't really make sense. Just write out, in detail, what you are hoping to accomplish and we'll be able to provide some help.

It is doing a validation so the user cannot enter password as password

here is the full validation code:
Len([password])>=6 And Len([Password])<=15 And InStr([Password],"password")=0

Help with InStr method would help

CreganTur
06-03-2010, 06:47 AM
InStr returns the the position within a string where the string to look for can be found. It's for finding the starting position of the first occurance of a word or phrase within a string.

You shouldn't be using InStr for your code. Try this instead:
Len([password]) > 6 And Len([Password]) <= 15 And [Password] <> "password"
This code actually specifies the conditional that the value of the Password field cannot be a string with the value "password"