MsgBox

S

Secret Squirrel

Ok I thought this was pretty simple but I was wrong. Or maybe I'm just
overlooking something. I'm trying to put an event in the afterupate of my
combo box "EmpName" that will have a msgbox appear if control
"VacationAvailable" = "0".

If Me.VacationAvailable = "0" Then
MsgBox("This Employee has 0 vacation days available. This Vacation
Request cannot be processed", vbOKOnly) = vbOKOnly
Me.Undo
Else

End If

I keep getting a message that says "Function call on left-hand side of
assignment must return Variant or Object". What does that mean?
 
D

Douglas J. Steele

When used with parentheses, MsgBox is a function. You're trying to assign a
value to the function, which isn't allowed.

Try:

If Me.VacationAvailable = "0" Then
MsgBox "This Employee has 0 vacation days available. This Vacation
Request cannot be processed", vbOKOnly
Me.Undo
Else

End If
 
Top