Report based on query depending on results of the query

  • Thread starter Thread starter Ang
  • Start date Start date
A

Ang

I have a report of which the contents is based on a query. The query which
the report is based on is it self based on the results of another query. The
first query will always contain records however, the second query may not.
How do I tell the report that if the second query contains no records then
use the first query?

Can anyone help with this please?
 
I have a report of which the contents is based on a query. The query which
the report is based on is it self based on the results of another query. The
first query will always contain records however, the second query may not.
How do I tell the report that if the second query contains no records then
use the first query?

Can anyone help with this please?

Use an event on a form to open the Report.

Dim strFilter as String
If DCount("*","Query2")>0 Then
strFilter = "Query2"
Else
strFilter = "Query1"
End If

DoCmd.OpenReport "ReportName",acViewPreview,strFilter
 
Thank you for your help. It now opens the correct query if the first is
empty however it is not showing it in the report. I am getting an empty
report as well as the correct query (separate) but not in the report. The
data source of the report is the final query.
 
Back
Top