what does this 'Object required' message mean?

T

Ted

hi, when i try to run this code behind the click event of a cmd button to
test the error trapping logic i decided to add to it, i seem to keep getting
a small box displaying bearing the message in the Subject.

can somebody show me the error of my ways?

discordant code follows immediately below:

Private Sub TrackSite_Click()
Dim Response As Integer
On Error GoTo Err_TrackSite_Click

Dim stDocName As String
Dim strWhere As String
If Me.StartDate Is Not Null And Me.StopDate <> #1/1/1899# Then
stDocName = "Patients on Follow-Up"
strWhere = "[FollowUp] Between #" & _
Forms![Tracking Print]![StartDate] & _
"# And #" & Forms![Tracking Print]![StopDate] & "#"
DoCmd.OpenReport stDocName, acViewPreview, , strWhere
Else
Response = MsgBox("You have failed to enter valid dates. Review and
correct your entries.", vbOKOnly + vbCritical, "Error")
End If
Exit_TrackSite_Click:
Exit Sub

Err_TrackSite_Click:
MsgBox Err.description
Resume Exit_TrackSite_Click

End Sub
 
D

Dirk Goldgar

Ted said:
hi, when i try to run this code behind the click event of a cmd
button to test the error trapping logic i decided to add to it, i
seem to keep getting a small box displaying bearing the message in
the Subject.

can somebody show me the error of my ways?

discordant code follows immediately below:

Private Sub TrackSite_Click()
Dim Response As Integer
On Error GoTo Err_TrackSite_Click

Dim stDocName As String
Dim strWhere As String
If Me.StartDate Is Not Null And Me.StopDate <> #1/1/1899# Then
[...]

You can't use the "Is Not Null" syntax in VBA code; that's a SQL
construct. Instead, use the IsNull() function:

If IsNull(Me.StartDate) = False And Me.StopDate <> #1/1/1899# Then
 
T

Ted

Thanks a million or two, Dirk :)

Ted

Dirk Goldgar said:
Ted said:
hi, when i try to run this code behind the click event of a cmd
button to test the error trapping logic i decided to add to it, i
seem to keep getting a small box displaying bearing the message in
the Subject.

can somebody show me the error of my ways?

discordant code follows immediately below:

Private Sub TrackSite_Click()
Dim Response As Integer
On Error GoTo Err_TrackSite_Click

Dim stDocName As String
Dim strWhere As String
If Me.StartDate Is Not Null And Me.StopDate <> #1/1/1899# Then
[...]

You can't use the "Is Not Null" syntax in VBA code; that's a SQL
construct. Instead, use the IsNull() function:

If IsNull(Me.StartDate) = False And Me.StopDate <> #1/1/1899# Then

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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