Not Like Error

ria4life

Registered User.
Local time
Today, 11:57
Joined
Feb 24, 2016
Messages
40
Need some help with this command...Access VBA gives me an error on this: Compile Error...Expected Expression over the (Like) part of the command


elseif me.adjustmentfield Is Null OR Not Like "*[!0-9]*" then

MsgBox Prompt:="Only Whole Numbers Can be Entered...Try Again!", Buttons:=vbOKOnly, Title:="Quantity Invalid"

thanks in Advance
 
You need to add the test criteria in full each time;
Code:
elseif me.adjustmentfield Is Null OR [COLOR="Red"]me.adjustmentfield[/COLOR] Not Like "*[!0-9]*" then

MsgBox Prompt:="Only Whole Numbers Can be Entered...Try Again!", Buttons:=vbOKOnly, Title:="Quantity Invalid"
 
Minty,

Tried it but i get the same error.Compile error on the same line:

elseif me.adjustmentfield Is Null OR me.adjustmentfield Not Like "*[!0-9]*" then
 
Well I missed a school boy error in my answer as well.

Code:
elseif  [COLOR="Red"]IsNull(me.adjustmentfield) [/COLOR]OR me.adjustmentfield Not Like "*[!0-9]*" then

MsgBox Prompt:="Only Whole Numbers Can be Entered...Try Again!", Buttons:=vbOKOnly, Title:="Quantity Invalid"

Can you check you are pasting the actual code as well as me. would always come out as Me. if the editor accepted the line.
 
in VBA this

OR me.adjustmentfield Not Like "*[!0-9]*"

needs to be

OR NOT (me.adjustmentfield Like "*[!0-9]*")
 
Thanks Guys:

CJ London...your solution worked as expected.
 

Users who are viewing this thread

Back
Top Bottom