Re: Report Error With No Data
- From: Marshall Barton <marshbarton@xxxxxxxxxx>
- Date: Mon, 17 Jul 2006 19:31:23 -0500
rmcompute wrote:
I set up code to read a table of reports and run them and then export to Excel:
DoCmd.OpenReport Me.cboReportType, acViewPreview
strReportxls = strPath & Me.cboReportType & ".xls"
DoCmd.OutputTo acOutputReport, Me.cboReportType, acFormatXLS,
strReportxls, False
Inside the report is code for a heading:
=DLookUp("StartDate","tblSRRptPeriod","RptPeriod = '" & [RptPeriod] & " ' ")
The report exports to Excel fine, but when there is no data abends from the
DLookup. I tried testing for a null RptPeriod (The field in the table), but
that did not work. Is there a way after issuing this command:
DoCmd.OpenReport Me.cboReportType, acViewPreview, to NOT issue the next
command if there was no data ?
Generally, you should use the report's NoData event to
Cancel the report.
--
Marsh
MVP [MS Access]
.
- Prev by Date: Re: VBA Report Grouping
- Next by Date: Re: Report Orderby and Groupby in VB
- Previous by thread: Re: VBA Report Grouping
- Next by thread: Re: Report Orderby and Groupby in VB
- Index(es):
Relevant Pages
|