Runtime Error '424'-Object Required

G

GoBrowns!

I keep getting this error in my code.... not sure how to debug.

Here is my code... the line where the problems start is **.

Private Sub cmdValidate_Click()

Dim strVacationError As String
Dim strVacationVerified As String
Dim strSickError As String
Dim strSickVerified As String

If intVacationUsed Is Not Null Then ********
If intRemainingVacation - intVacationUsed < 0 Then
strVacationError = MsgBox( _
Prompt:="Submission will cause Employee to exceed vacation
allowance." & vbLf & _
"Please adjust before submitting.", _
Buttons:=vbOKOnly + vbCritical, _
Title:="Validation Error")
Else
strVacationVerified = MsgBox( _
Prompt:="Vacation submission verified. Please submit.", _
Buttons:=vbOKOnly + vbExclamation, _
Title:="Validation Successful!")
End If
End If

If intSickUsed Is Not Null Then
If intRemainingSick - intSickUsed < 0 Then
strSickError = MsgBox( _
Prompt:="Submission will cause Employee to exceed sick time
allowance." & vbLf & _
"Please adjust before submitting.", _
Buttons:=vbOKOnly + vbCritical, _
Title:="Validation Error")
Else
strSickVerified = MsgBox( _
Prompt:="Sick time submission verified. Please submit.", _
Buttons:=vbOKOnly + vbExclamation, _
Title:="Validation Successful!")
End If
End If
End Sub

Thanks for the help!!!!!!
 
J

Jeanette Cunningham

Dim intVacationUsed as Long
Dim intRemainingVacation as Long

Next you need to supply a value for intVacationUsed

maybe
intVacationUsed = Me.VacationUsed


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
G

Graham Mandeno

"Is Null" and "Is Not Null" are valid only in SQL.

In VBA, use the IsNull() function:

If Not IsNull(intVacationUsed) Then ...

and the same later on for intSickUsed.
 
J

Jeanette Cunningham

Thanks Graham


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Graham Mandeno said:
"Is Null" and "Is Not Null" are valid only in SQL.

In VBA, use the IsNull() function:

If Not IsNull(intVacationUsed) Then ...

and the same later on for intSickUsed.

--
Good Luck :)

Graham Mandeno [Access MVP]
Auckland, New Zealand

GoBrowns! said:
I keep getting this error in my code.... not sure how to debug.

Here is my code... the line where the problems start is **.

Private Sub cmdValidate_Click()

Dim strVacationError As String
Dim strVacationVerified As String
Dim strSickError As String
Dim strSickVerified As String

If intVacationUsed Is Not Null Then ********
If intRemainingVacation - intVacationUsed < 0 Then
strVacationError = MsgBox( _
Prompt:="Submission will cause Employee to exceed vacation
allowance." & vbLf & _
"Please adjust before submitting.", _
Buttons:=vbOKOnly + vbCritical, _
Title:="Validation Error")
Else
strVacationVerified = MsgBox( _
Prompt:="Vacation submission verified. Please submit.", _
Buttons:=vbOKOnly + vbExclamation, _
Title:="Validation Successful!")
End If
End If

If intSickUsed Is Not Null Then
If intRemainingSick - intSickUsed < 0 Then
strSickError = MsgBox( _
Prompt:="Submission will cause Employee to exceed sick
time
allowance." & vbLf & _
"Please adjust before submitting.", _
Buttons:=vbOKOnly + vbCritical, _
Title:="Validation Error")
Else
strSickVerified = MsgBox( _
Prompt:="Sick time submission verified. Please submit.", _
Buttons:=vbOKOnly + vbExclamation, _
Title:="Validation Successful!")
End If
End If
End Sub

Thanks for the help!!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top