Graphs on a Report with no data

G

Guest

I have a graph on a report and it's data is coming from a query. How can I
display a message box or something to the user indicating that there is no
data for the graph instead displaying a blank graph when the query returns
zero rows per the criteria entered by the user?
 
O

OfficeDev18 via AccessMonster.com

Simple.

Dim rst As DAO.Recordset 'assuming you're using DAO

Set rst=CurrentDb.OpenRecordset("YourQueryNameHere", dbOpenDynaset)
If rst.RecordCount = 0 Then
MsgBox "There are no records to graph!"
 
G

Guest

I did not use a DAO. I am fairly new to access. Is this something that I
should do? I created the graphs using the chart wizard.
 
O

OfficeDev18 via AccessMonster.com

It doesn't matter. To check what you are using, do the following. Open the
VBA editor, and click on the Tools-->References pull-down menu. Which is
checked, Microsoft DAO 3.06 Object Library, or Microsoft ActiveX Data Objects
2.1 Library? If they are both checked, which one is physically closer to the
top of the page? That is the answer to the question. If you are using ActiveX.
...., (ADO), you do not need the "DAO." before the Recordset declaration.
Simply say

Dim rst As Recordset
I did not use a DAO. I am fairly new to access. Is this something that I
should do? I created the graphs using the chart wizard.
[quoted text clipped - 15 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top