S
Steve
Hi,
I copied the code from a switchboard button the works, but get a "compile
error, variable not defined" error message for this one. I highlights the
"stCriterion = statement.
Any help would be gratefully accepted.
Thanks,
Private Sub cmdMissedReq_Click()
On Error GoTo Err_cmdMissedReq_Click
Dim stDocName As String
Dim stStartDate As Date
Dim stEndDate As Date
stCriterion = ""
If IsNull(Forms!frmRptsbyDate!StartDate) Then
MsgBox "No Start Date, using All Dates"
GoTo Print_Report
End If
stStartDate = Forms!frmRptsbyDate!StartDate
If IsNull(Forms!frmRptsbyDate!EndDate) Then
MsgBox "No End Date, using All Dates"
GoTo Print_Report
End If
stEndDate = Forms!frmRptsbyDate!EndDate
stCriterion = "(RequestDate between #" & stStartDate & "# AND #" &
stEndDate & "#)"
stDocName = "rptMissedRequests"
DoCmd.OpenReport stDocName, acPreview, , stCriterion
Print_Report:
stDocName = "rptMissedRequests"
DoCmd.OpenReport stDocName, acPreview, , stCriterion
Exit_cmdMissedReq_Click:
Exit Sub
Err_cmdMissedReq_Click:
MsgBox Err.Description
Resume Exit_cmdMissedReq_Click
End Sub
I copied the code from a switchboard button the works, but get a "compile
error, variable not defined" error message for this one. I highlights the
"stCriterion = statement.
Any help would be gratefully accepted.
Thanks,
Private Sub cmdMissedReq_Click()
On Error GoTo Err_cmdMissedReq_Click
Dim stDocName As String
Dim stStartDate As Date
Dim stEndDate As Date
stCriterion = ""
If IsNull(Forms!frmRptsbyDate!StartDate) Then
MsgBox "No Start Date, using All Dates"
GoTo Print_Report
End If
stStartDate = Forms!frmRptsbyDate!StartDate
If IsNull(Forms!frmRptsbyDate!EndDate) Then
MsgBox "No End Date, using All Dates"
GoTo Print_Report
End If
stEndDate = Forms!frmRptsbyDate!EndDate
stCriterion = "(RequestDate between #" & stStartDate & "# AND #" &
stEndDate & "#)"
stDocName = "rptMissedRequests"
DoCmd.OpenReport stDocName, acPreview, , stCriterion
Print_Report:
stDocName = "rptMissedRequests"
DoCmd.OpenReport stDocName, acPreview, , stCriterion
Exit_cmdMissedReq_Click:
Exit Sub
Err_cmdMissedReq_Click:
MsgBox Err.Description
Resume Exit_cmdMissedReq_Click
End Sub