• No data for report (2000 (SP3))

    Author
    Topic
    #418319

    I have a form that is used to select date parameters. When I click OK these are turned into a filter for a report and then DoCmd.OpenReport is fired. If there is no data I was getting an error message for the report so I inserted an On No Data event into the report to give a message saying there is no data then cancel the report opening. This creates an error in the original OnClick event in the form. Error 2501 Open report was cancelled. How do I back out of the DoCmd.OpenReport if there is no data?

    I’ll give you more info if this is unclear. I suspect it is simple but the old brain isn’t up to it right now.

    Viewing 0 reply threads
    Author
    Replies
    • #941057

      Just trap the 2501 error in the calling routine and ignore it. It’s one of those irritating messages that is absolutely meaningless when you use the NoData event to cancel a report. shrug

      Something like this in your error handler:

      If Err = 2501 Then
      ' ignore it
      Else
      ...
      End If

      • #941198

        I suspected it was that simple. Thanks for saving me six hours of trying different things! cheers

    Viewing 0 reply threads
    Reply To: No data for report (2000 (SP3))

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: