troubleshooting Question

Adding a field name to an output file name in Access

Avatar of kdr2003
kdr2003 asked on
Microsoft Access
25 Comments1 Solution460 ViewsLast Modified:
have a macro in Access that opens 10 different reports.  Each report is sent to an output file with a different name.  Is there a way to add a field from the report to the outpur file name?  Attached is the code.

Option Compare Database

'------------------------------------------------------------
' Accounting_Reports1
'
'------------------------------------------------------------
Function Accounting_Reports1()
On Error GoTo Accounting_Reports1_Err

    DoCmd.OutputTo acReport, "4 Telecomm Giro Paisano (Acct Rpt) May 2004", "SnapshotFormat(*.snp)", "g:\user\eporeports\Giro Paisano 022207.snp", False, ""
    DoCmd.OutputTo acReport, "4 Telecomm Giro (Acct Rpt) May 2004", "SnapshotFormat(*.snp)", "G:\user\eporeports\Giro Telegrafico 022207.snp", False, ""
    DoCmd.OutputTo acReport, "2 Telecomm Trans (Acct Rept) Dia Siguiente May 2004", "SnapshotFormat(*.snp)", "G:\user\eporeports\Dia Siguente 022207.snp", False, ""
    DoCmd.OutputTo acReport, "2 Telecomm Trans (Acct Rept) Din Min May 2004", "SnapshotFormat(*.snp)", "G:\user\eporeports\Dinero en Minutos 022207.snp", False, ""
    DoCmd.OutputTo acReport, "7 Bital Acct Rep 11xx02", "SnapshotFormat(*.snp)", "G:\user\eporeports\Bital 022207.snp", False, ""
    DoCmd.OutputTo acReport, "9 Banamex Foreign Fx adjusted", "SnapshotFormat(*.snp)", "G:\user\eporeports\Banamex Foreign FX 022207.snp", False, ""
    DoCmd.OutputTo acReport, "9 Banamex US FX adjusted", "SnapshotFormat(*.snp)", "G:\user\eporeports\Banamex US FX 022207.snp", False, ""
    DoCmd.OutputTo acReport, "CEMECA Acct Rept 021904", "SnapshotFormat(*.snp)", "G:\user\eporeports\CEMECA 022207.snp", False, ""
    DoCmd.OutputTo acReport, "6 Commercial Mexicana Accounting Report Foreign", "SnapshotFormat(*.snp)", "G:\user\eporeports\Commercial Mexicana Foreign 022207.snp", False, ""
    DoCmd.OutputTo acReport, "6 Commercial Mexicana Accounting Report US", "SnapshotFormat(*.snp)", "G:\user\eporeports\Commercial Mexicana US 022207.snp", False, ""
    DoCmd.OutputTo acReport, "8 HEB Foreign FX Adjusted", "SnapshotFormat(*.snp)", "G:\user\eporeports\HEB Foreign 022207.snp", False, ""
    DoCmd.OutputTo acReport, "8 HEB US FX adjusted", "SnapshotFormat(*.snp)", "G:\user\eporeports\HEB US 022207.snp", False, ""
    DoCmd.OutputTo acReport, "AMEX Inbound Accounting Report", "SnapshotFormat(*.snp)", "g:/user/eporeports/Amex Inbound Accounting Report 022207.snp", False, ""


Accounting_Reports1_Exit:
    Exit Function

Accounting_Reports1_Err:
    MsgBox Error$
    Resume Accounting_Reports1_Exit

End Function
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 25 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 25 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros