MS Access Report NO Data

Posted on 2012-09-18
Last Modified: 2012-09-18
Been a while since I was in MS Access.

Theres a report that runs fine unless there is no data

Then all the fields show the #Error message

How do I get this to show as blanks or not at all?
Question by:lrbrister
    LVL 61

    Accepted Solution

    Try this in the report's Open Event:

    If Me.HasData = False then
        Msgbox "There is no data to report"
        Cancel = true
    End if

    Open in new window

    And add error handling in the code that opens the report:
    On Error Resume Next
    Docmd.OpenReport "YourReportName", acViewPreview

    Open in new window

    LVL 56

    Expert Comment

    by:Jim Dettman (Microsoft MVP/ EE MVE)
    Or use the reports NoData event and cancel the report opening with:

     Cancel = True


    Author Closing Comment

    Perfect.  Thanks.

    Like I said, been a while, as I've been .Net and SQL Server the past 10 years

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
    Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
    What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
    The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now