I need help with this step!
I can generate reports from a form on which I choose a date range, and select one or more fields in drop downs (eg. "Unit"); I can do one at a time, but I'd like to generate all reports that have data, i.e., where the report query in the date range does not return NULL.
Here is my code for a single report, output as .snp:
Private Sub UnitReport_Click()
On Error GoTo Err_UnitReport_Click
Dim stDocName As String
Dim stPrintFileName As String
Dim stDate As String
Dim stUnit As String
stDocName = "detail_unit"
stUnit = Forms![f_rpt]![cbUnit]
stDate = Format(Forms![f_rpt]![cbFromDate], "mmddyy")
stPrintFileName = stUnit & "_" & stDate
DoCmd.OutputTo acReport, stDocName, "Snapshot Format", "S:\Walkround\Report\" & stPrintFileName & ".snp", False
Exit_UnitReport_Click:
Exit Sub
Err_UnitReport_Click:
MsgBox Err.Description
Resume Exit_UnitReport_Click
End Sub
What I'd like to do is code such that I don't use the combobox cbUnit field but rather find that field ("Unit") from either a query ("q_UnitHasData") that returns a list of Units with data within the date range, or work with all possible field values for "Unit" and use something like Report.HasData.
This must be easy, right? Is this enough information to go on?
Thanks,
Tom
I can generate reports from a form on which I choose a date range, and select one or more fields in drop downs (eg. "Unit"); I can do one at a time, but I'd like to generate all reports that have data, i.e., where the report query in the date range does not return NULL.
Here is my code for a single report, output as .snp:
Private Sub UnitReport_Click()
On Error GoTo Err_UnitReport_Click
Dim stDocName As String
Dim stPrintFileName As String
Dim stDate As String
Dim stUnit As String
stDocName = "detail_unit"
stUnit = Forms![f_rpt]![cbUnit]
stDate = Format(Forms![f_rpt]![cbFromDate], "mmddyy")
stPrintFileName = stUnit & "_" & stDate
DoCmd.OutputTo acReport, stDocName, "Snapshot Format", "S:\Walkround\Report\" & stPrintFileName & ".snp", False
Exit_UnitReport_Click:
Exit Sub
Err_UnitReport_Click:
MsgBox Err.Description
Resume Exit_UnitReport_Click
End Sub
What I'd like to do is code such that I don't use the combobox cbUnit field but rather find that field ("Unit") from either a query ("q_UnitHasData") that returns a list of Units with data within the date range, or work with all possible field values for "Unit" and use something like Report.HasData.
This must be easy, right? Is this enough information to go on?
Thanks,
Tom