Problem with MsgBox

  • Thread starter jubiiab via AccessMonster.com
  • Start date
J

jubiiab via AccessMonster.com

Hi

Below I have made a small code but the VB-editor keep writing:

Compile error: Expected: =

There is something wrong with the MsgBox but what??

Private Sub Form_Open(Cancel As Integer)
If [ServiceDate] < Now() Then
MsgBox ("service date overdue!", vbInformation, "Service date" )

End If
End Sub
 
A

Allen Browne

Remove the brackets:
MsgBox "service date overdue!", vbInformation, "Service date"

VBA has a MsgBox statement (without the brackets above) and a MsgBox()
function. You used the function, and it doesn't know what to assign the
return value to.
 
J

jubiiab via AccessMonster.com

it works now...thx mate

Allen said:
Remove the brackets:
MsgBox "service date overdue!", vbInformation, "Service date"

VBA has a MsgBox statement (without the brackets above) and a MsgBox()
function. You used the function, and it doesn't know what to assign the
return value to.
Below I have made a small code but the VB-editor keep writing:
[quoted text clipped - 8 lines]
End If
End Sub
 
Top