Assuming that the field is a text field (otherwise leading zeroes would be irrelevant), try
IF Left(IdentificationNumber,6) <> "000001" AND Left(IdentificationNumber,6) <> "000002" Then 'Do something here End IF
Note the use of AND instead of OR. Your boolean logic would have run the code every time. Since if the value is 000001 then it is by definition not 000002. And vice versa for 000002. And of course any other value would be true for both parts of the if statement.
"CalBerkleyTekkie" <andrew.menendez[ at ]raymondjames.com> wrote in message news:1159558463.633627.175590[ at ]e3g2000cwe.googlegroups.com...
[Quoted Text] > Hopefully this will be easy for some people. > > I'm trying to write an If statement in VBA for access, however I think > I am formatting it wrong. What I am logically trying to do is this: If > the first 6 numbers in this given field does not equal 000001 or > 000002, then carry out the rest of the function. Currently I have it > formatted like this: > > If IdentificationNumber <> 000001 Or IdentificationNumber <> 000002 > Then > > Any suggestions? Thanks! > > -Jimmy >
|