G
Guest
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 ?
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 ?