If Statement Problem

D

DS

I'm having a Problem with The Like Part any help appreciated.
Thanks
DS

If IsNull(Me.TxtAddress) Or _
Me.TxtAddress (Like "*?@?*.?*") And _
(Not Like "*[ ,;]*")) Then
MsgBox "OK"
Else
MsgBox "INVALID"
End If
 
B

Bob Howard

I believe the problem is with the NOT LIKE ... that "sentence" has a
predicate but no subject ... you must repeat the Me.TxtAddress portion...

Bob.

If IsNull(Me.TxtAddress) Or _
(Me.TxtAddress (Like "*?@?*.?*") And _
Me.TxtAddress Not (Like "*[ ,;]*")) Then
MsgBox "OK"
Else
MsgBox "INVALID"
End If
 
D

DS

Bob said:
I believe the problem is with the NOT LIKE ... that "sentence" has a
predicate but no subject ... you must repeat the Me.TxtAddress portion...

Bob.

If IsNull(Me.TxtAddress) Or _
(Me.TxtAddress (Like "*?@?*.?*") And _
Me.TxtAddress Not (Like "*[ ,;]*")) Then
MsgBox "OK"
Else
MsgBox "INVALID"
End If

I'm having a Problem with The Like Part any help appreciated.
Thanks
DS

If IsNull(Me.TxtAddress) Or _
Me.TxtAddress (Like "*?@?*.?*") And _
(Not Like "*[ ,;]*")) Then
MsgBox "OK"
Else
MsgBox "INVALID"
End If
I tried your suggestion but Like keeps coming up in red.
Thanks
DS
 
T

tina

SQL understands the Like operator, but i don't believe you can use it in VBA
expressions. you might take a look at the Eval() function and see if that
will lend itself to solving the dilemma.

hth


DS said:
Bob said:
I believe the problem is with the NOT LIKE ... that "sentence" has a
predicate but no subject ... you must repeat the Me.TxtAddress portion...

Bob.

If IsNull(Me.TxtAddress) Or _
(Me.TxtAddress (Like "*?@?*.?*") And _
Me.TxtAddress Not (Like "*[ ,;]*")) Then
MsgBox "OK"
Else
MsgBox "INVALID"
End If

I'm having a Problem with The Like Part any help appreciated.
Thanks
DS

If IsNull(Me.TxtAddress) Or _
Me.TxtAddress (Like "*?@?*.?*") And _
(Not Like "*[ ,;]*")) Then
MsgBox "OK"
Else
MsgBox "INVALID"
End If
I tried your suggestion but Like keeps coming up in red.
Thanks
DS
 
D

DS

tina said:
SQL understands the Like operator, but i don't believe you can use it in VBA
expressions. you might take a look at the Eval() function and see if that
will lend itself to solving the dilemma.

hth


Bob Howard wrote:

I believe the problem is with the NOT LIKE ... that "sentence" has a
predicate but no subject ... you must repeat the Me.TxtAddress
portion...
Bob.

If IsNull(Me.TxtAddress) Or _
(Me.TxtAddress (Like "*?@?*.?*") And _
Me.TxtAddress Not (Like "*[ ,;]*")) Then
MsgBox "OK"
Else
MsgBox "INVALID"
End If



I'm having a Problem with The Like Part any help appreciated.
Thanks
DS

If IsNull(Me.TxtAddress) Or _
Me.TxtAddress (Like "*?@?*.?*") And _
(Not Like "*[ ,;]*")) Then
MsgBox "OK"
Else
MsgBox "INVALID"
End If
I tried your suggestion but Like keeps coming up in red.
Thanks
DS
Ok it seems that I have to go into another direction.
I'll update.
Thanks, Tina.
DS
 
T

tina

you're welcome :)


DS said:
tina said:
SQL understands the Like operator, but i don't believe you can use it in VBA
expressions. you might take a look at the Eval() function and see if that
will lend itself to solving the dilemma.

hth


Bob Howard wrote:


I believe the problem is with the NOT LIKE ... that "sentence" has a
predicate but no subject ... you must repeat the Me.TxtAddress
portion...

Bob.

If IsNull(Me.TxtAddress) Or _
(Me.TxtAddress (Like "*?@?*.?*") And _
Me.TxtAddress Not (Like "*[ ,;]*")) Then
MsgBox "OK"
Else
MsgBox "INVALID"
End If



I'm having a Problem with The Like Part any help appreciated.
Thanks
DS

If IsNull(Me.TxtAddress) Or _
Me.TxtAddress (Like "*?@?*.?*") And _
(Not Like "*[ ,;]*")) Then
MsgBox "OK"
Else
MsgBox "INVALID"
End If



I tried your suggestion but Like keeps coming up in red.
Thanks
DS
Ok it seems that I have to go into another direction.
I'll update.
Thanks, Tina.
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top