G
Guest
My report is not reacting the way it used to when asked for data that isn't
there. The no data event used to work, but now it is tossing an error 2051.
this is what i have for my command button on my form that opens the report
Private Sub cmdOpen_Click()
On Error GoTo Err_cmdOpen_Click
Dim stDocName As String
stDocName = "rptDailyProductionNew"
DoCmd.OpenReport stDocName, acViewPreview
Exit_cmdOpen_Click:
Exit Sub
Err_cmdOpen_Click:
MsgBox Err.Description
Resume Exit_cmdOpen_Click
End Sub
and this is what i have for my no data event in my report
Private Sub Report_NoData(Cancel As Integer)
On Error GoTo ErrHandler
MsgBox "Sorry. There are no records" & vbCrLf & vbCrLf & _
"to display for this report.", vbInformation + vbOKOnly, _
" No Records"
Cancel = True
Exit Sub
ErrHandler:
MsgBox "Error in Report_NoData( )" & vbCrLf & _
"in " & Me.Name & " report." & vbCrLf & vbCrLf & _
Err.Number & vbCrLf & Err.Description
End Sub
like i said this used to work, and i use this for other reports in my
database and they work without problems, so i'm not seeing what the problem
is. any help would be greatly appreciated.
there. The no data event used to work, but now it is tossing an error 2051.
this is what i have for my command button on my form that opens the report
Private Sub cmdOpen_Click()
On Error GoTo Err_cmdOpen_Click
Dim stDocName As String
stDocName = "rptDailyProductionNew"
DoCmd.OpenReport stDocName, acViewPreview
Exit_cmdOpen_Click:
Exit Sub
Err_cmdOpen_Click:
MsgBox Err.Description
Resume Exit_cmdOpen_Click
End Sub
and this is what i have for my no data event in my report
Private Sub Report_NoData(Cancel As Integer)
On Error GoTo ErrHandler
MsgBox "Sorry. There are no records" & vbCrLf & vbCrLf & _
"to display for this report.", vbInformation + vbOKOnly, _
" No Records"
Cancel = True
Exit Sub
ErrHandler:
MsgBox "Error in Report_NoData( )" & vbCrLf & _
"in " & Me.Name & " report." & vbCrLf & vbCrLf & _
Err.Number & vbCrLf & Err.Description
End Sub
like i said this used to work, and i use this for other reports in my
database and they work without problems, so i'm not seeing what the problem
is. any help would be greatly appreciated.