Runtime error 424-Event Expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a field [PassFail] where the required entry is either
Null, the word PASS or the word FAIL. I want to code an After Update Event
for a MsgBox if the entry in the field is not Null, PASS or FAIL. I've tried
various methods to no avail. Here's my last attempt -- I'm getting a Runtime
error 424: Object Required error:

If Me.PassFail Is Not Null And Not Me.PassFail = "Pass" And Not Me.PassFail
= "Fail" Then
MsgBox ("Please input 'Pass' or 'Fail' only"), vbCritical, , , vbOK
End If

Please tell me what I need to code to get the message box to display. I'm
using Access 2002. Thanks!
 
Vikki,

If Len(Nz(Me!PassFail, "")) > 0 And Nz(Me!PassFail, "") <> "Pass" And
Nz(Me!PassFail, "") <> "Fail" Then

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
That got me past the first line ... now I'm getting a Runtime Error '5'
(Invalid Procedure Call or Argument) on:

MsgBox "Please input 'Pass' or 'Fail' only", vbCritical, , , vbOK

More Help ... please !?!?!? Thanks for your speedy response!

Vicki

Graham R Seach said:
Vikki,

If Len(Nz(Me!PassFail, "")) > 0 And Nz(Me!PassFail, "") <> "Pass" And
Nz(Me!PassFail, "") <> "Fail" Then

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

VickiS said:
I have a form with a field [PassFail] where the required entry is either
Null, the word PASS or the word FAIL. I want to code an After Update Event
for a MsgBox if the entry in the field is not Null, PASS or FAIL. I've
tried
various methods to no avail. Here's my last attempt -- I'm getting a
Runtime
error 424: Object Required error:

If Me.PassFail Is Not Null And Not Me.PassFail = "Pass" And Not
Me.PassFail
= "Fail" Then
MsgBox ("Please input 'Pass' or 'Fail' only"), vbCritical, , , vbOK
End If

Please tell me what I need to code to get the message box to display. I'm
using Access 2002. Thanks!
 
Viki,

I don't know how you came to arrive at that syntax for MsgBox, but here's
what you should be using:
MsgBox "Please input 'Pass' or 'Fail' only", vbCritical + vbOKOnly

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

VickiS said:
That got me past the first line ... now I'm getting a Runtime Error '5'
(Invalid Procedure Call or Argument) on:

MsgBox "Please input 'Pass' or 'Fail' only", vbCritical, , , vbOK

More Help ... please !?!?!? Thanks for your speedy response!

Vicki

Graham R Seach said:
Vikki,

If Len(Nz(Me!PassFail, "")) > 0 And Nz(Me!PassFail, "") <> "Pass" And
Nz(Me!PassFail, "") <> "Fail" Then

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

VickiS said:
I have a form with a field [PassFail] where the required entry is either
Null, the word PASS or the word FAIL. I want to code an After Update
Event
for a MsgBox if the entry in the field is not Null, PASS or FAIL. I've
tried
various methods to no avail. Here's my last attempt -- I'm getting a
Runtime
error 424: Object Required error:

If Me.PassFail Is Not Null And Not Me.PassFail = "Pass" And Not
Me.PassFail
= "Fail" Then
MsgBox ("Please input 'Pass' or 'Fail' only"), vbCritical, , , vbOK
End If

Please tell me what I need to code to get the message box to display.
I'm
using Access 2002. Thanks!
 
Back
Top