Graphs on a Report with no data

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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!"
 
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.
 
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]
 
Back
Top