hope it`s simple

  • Thread starter Thread starter Ron
  • Start date Start date
R

Ron

I have a query that get the criteria from form1
On form1 I have a command button that open a second form (Chatform)with a
chart that applies to the data from query.
when query returns with no data Chartform open with blank chart.
Instead I would like to have counter that if it will be 0 then I`ll get
message "No data, can not create the chart"

Please help,

Thanks
 
You could use the DCount function using the same criteria you use for the
query that builds the chart and only open the form if there is data:

If DCount("*","QueryOrTableName", "Same Criteria Here") = 0 Then
MsgBox "No Data Available For Chart"
Else
DoCms.OpenForm....
End If
 
Thanks, works just fine.
Klatuu said:
You could use the DCount function using the same criteria you use for the
query that builds the chart and only open the form if there is data:

If DCount("*","QueryOrTableName", "Same Criteria Here") = 0 Then
MsgBox "No Data Available For Chart"
Else
DoCms.OpenForm....
End If
 
Since the query supposedly refers to form controls for its
parameters, there is no additional criteria to use in the
DCount. Just using:
DCount("*", "QueryOrTableName")
should be all that's needed.
 

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

Back
Top