Question Syntax Error, I just can't see what's wrong

benjihubbs

New member
Local time
Today, 20:38
Joined
Sep 26, 2012
Messages
4
Hi Guys, a pretty simple one, probably, I've built this expression and it looks like it should work, but all I'm getting is syntax errors, I just can't see what's wrong :(
Code:
= IIf( [Lesson] = 12 Hour , 12 , AccessError(Please select lesson type) )

Cheers
 
AccessError requires an integer as an argument.

What is "Please select lesson type"? If it the name of a variable / field then it would need to be in square brackets because it contains spaces "[Please select lesson type]".

Or were you trying to show a prompt as in MsgBox("Please select lesson type").
 
Right, I've tried that, but I'm still getting a syntax error, saying that I've entered an operand without an operator.

Code:
= IIf( [Lesson] = 12 Hour , 12 , MsgBox("Please select lesson type") )

What I want to do is:

Enter value 12 into a box, should the lesson field = 12 hour, otherwise I want it to prompt the user that they haven't entered a lesson type
 
Last edited:
Is 12 Hour not a String..?? So insert hem between double quotes..
Code:
= IIf( [Lesson] = "12 Hour" , 12 , MsgBox("Please select lesson type") )
 

Users who are viewing this thread

Back
Top Bottom