Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003

    Unanswered: Closing a report with no data to diplay

    I have a command button that opens a report. If the report doesnt have any data display (the query it is based on returns no rows) i get #error for some of my field. What i want is for a msgBox to pop up saying "no records returned" or something, and to not even display the report.

    I know reports have the "on no data" event. I got the message box to pop up, but how do i prevent the report from displaying? I tried a DoCmd.close but that gave me errors.

  2. #2
    Join Date
    Oct 2003
    Provided Answers: 1
    Try this

    Private Sub Report_NoData(Cancel As Integer)
    MsgBox "No data found! Closing report."
    Cancel = True
    End Sub

  3. #3
    Join Date
    May 2003
    Perfect, thanks a lot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts