Results 1 to 2 of 2
Thread: tweak module (2000)
2002-04-25, 17:13 #1
- Join Date
- Mar 2002
- Thanked 0 Times in 0 Posts
tweak module (2000)
I was wondering if it is possible to clean or shrink this module anymore than what it already is? Thanks beforehand!
DoCmd.OutputTo acOutputReport, "PO Tracker", acFormatXLS, "d:ReportsPO_Tracker" & Format(Date, "yyyymmdd") & ".xls"
DoCmd.OutputTo acOutputReport, "BCER-PO Summary", acFormatXLS, "d:ReportsBCER-PO_Summary" & Format(Date, "yyyymmdd") & ".xls"
DoCmd.OutputTo acOutputReport, "Budget Summary Report", acFormatXLS, "d:ReportsBudget_Summary_Report" & Format(Date, "yyyymmdd") & ".xls"
I'm using a macro to RunCode above.
2002-04-26, 04:21 #2
- Join Date
- Dec 2000
- Sacramento, California, USA
- Thanked 1 Time in 1 Post
Re: tweak module (2000)
Well, first of all, this is not a module, it's a function. A module is a container that holds code routines, including functions and subs.
Second, since all this function contains is 3 OutputTo commands, you aren't going to shrink it any. If you wanted to make it possible to add more reports to the function without adding more lines of code, you could tweak the code a bit by using a For Next loop to call a single OutputTo command and pass it different sets of string variables to pass the name of the report and the root name of the destination file. That would allow you to use more loops and add additional values to the arguments instead of adding more OutputTo lines. That would look something like this:
Dim strReport as String
Dim strDest As String
Dim intLoop As Integer
For intLoop = 1 to 3
strReport = Choose("PO Tracker", "BCER-PO Summary", "Budget Summary Report")
strDest = Choose("PO_Tracker","BCER-PO_Summary", "Budget_Summary_Report")
DoCmd.OutputTo acOutputReport, strReport, "d:Reports" & strReport & Format(Date, "yyyymmdd" & ".xls"