No data available help please

ptaylor-west

Registered User.
Local time
Today, 15:14
Joined
Aug 4, 2000
Messages
193
If I run a report from a command button and there is no data available the report opens with a blank report. If I run it from the Switchboard it gives a message saying that there is no data available. How do I get it to display this message from a normal command button
 
Use the NoData event, if you search here for the same there have been many answers.
 
Thanks Rich,

Your link didn't appear but you pointed me in the right direction, the only problem now is that becasue I used a commancd button to open the report, after I get my Msg Box I get another which is OpenReport Action is cancelled, how do I get rid of this second message ?

Thanks

Paul
 
Last edited:
Option Compare Database
Option Explicit
Const ConErrRptCanceled = 2501

Private Sub Preview_Click()
' Preview report.
Dim strDocName As String

On Error GoTo Err_Preview_Click
strDocName = "MyReport"
DoCmd.OpenReport strDocName, acViewPreview


Exit_Preview_Click:
Exit Sub

Err_Preview_Click:
If Err = ConErrRptCanceled Then
Resume Exit_Preview_Click
Else
MsgBox Err.Description
Resume Exit_Preview_Click
End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom