If Statement Problem

  • Thread starter Thread starter DS
  • Start date Start date
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
 
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
 
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
 
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
 
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
 
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
 
Back
Top