Help with IF Statement

joeserrone

The cat of the cul-de-sac
Local time
Today, 03:39
Joined
Dec 17, 2006
Messages
164
I have a VBA code similar to this one:
If Me. Account = "?" or Me.Account = Null Then
Me.AllowEdits = True
Else.....

However, many times the field tagged as ? can also come up with multiple ????????. So I need to create and IF statement that will look at the first character of the Account field, if the Account starts with ? then ......
 
If Left(Me.Account, 1) = "?"

I assume you don't really have the "= Null" in there, as that would not work.
 
You need to use the Like operator and also beaware that ? is a special character, also if looking for a Null field use IsNull
Thus I think that you need
If Me.Account Like "(?)*"or IsNull(Me.Account)l Then

But this is not tested.
Brian

Ah! yes Paul there is always an easier solution and a quicker typist.
 
Try: IsNull([YourField]) and Left([YourField],1) = "?"
FYI, *nothing* is ever = Null! Even Null.
 
Happy to help!

Brian, I'm not a faster typist; I just typed less. :p
 

Users who are viewing this thread

Back
Top Bottom