Help with IF statement

J

joeserrone

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 ......
 
D

DL

IMO, if the '?' character simply indicates that at a later date something
specific should be entered in this field, thus you are allowing edits, then
perhaps better to leave the field null in the first.

Otherwise look at the 'string' functions.
 
B

Beth Melton

Take a look at the Left function and use it to return the first character in
the string for comparison.

Also, are you sure your null expression is working? I'd use the IsNull
function.

Please post all follow-up questions to the newsgroup. Requests for
assistance by email cannot be acknowledged.

~~~~~~~~~~~~~~~
Beth Melton
Microsoft Office MVP

Coauthor of Word 2007 Inside Out:
http://www.microsoft.com/MSPress/books/9801.aspx#AboutTheBook

Word FAQ: http://mvps.org/word
TechTrax eZine: http://mousetrax.com/techtrax/
MVP FAQ site: http://mvps.org/
 
Top