Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Dec 2002
    Location
    Kitchener, Ontario, Canada
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts

    No data for report (2000 (SP3))

    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.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: No data for report (2000 (SP3))

    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. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

    Something like this in your error handler:

    <code>If Err = 2501 Then
    ' ignore it
    Else
    ...
    End If</code>
    Charlotte

  3. #3
    4 Star Lounger
    Join Date
    Dec 2002
    Location
    Kitchener, Ontario, Canada
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: No data for report (2000 (SP3))

    I suspected it was that simple. Thanks for saving me six hours of trying different things! <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

Posting Permissions

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