Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

E-mailing

Status
Not open for further replies.

VASunGrede77

Technical User
Jun 18, 2012
8
0
0
US
When using a macro to save a file, it asks for a file location....

What I would like to do is save the file with a date at the end of the file name... I.E. Master File 4-9-13

The current string to save the file reads:
Report, CombinedWarRoomReport, PDF Format (*.pdf), G:\Public\War Room\Published Reports\Master Spending.pdf, No, , 0, Print

Is there away to put the date at the end of "Master Spending" and have the date be whatever "Today" is?

Trying my best to make this "push button" as I will be gone on vacation for a week and when I say its in Access, most people run for the hills....

Thanks in advance!
 
Forgot one thing..... this is also being mailed out and in the subject line would like the date appear as well....

Current:
Report, CombinedWarRoomReport, PDF Format (*.pdf), me@work.com, , , Spending Report [looking to add date here], Attached is the current spending report, No,
 
I would replace

"G:\Public\War Room\Published Reports\Master Spending.pdf"

with

"G:\Public\War Room\Published Reports\Master Spending " + CStr(DatePart("m",Now())) + "-" + CStr(DatePart("d",Now())) + "-" + CStr(DatePart("yyyy",Now())) + ".pdf"


Similarly,

"Spending Report"

becomes

"Spending Report " + CStr(DatePart("m",Now())) + "-" + CStr(DatePart("d",Now())) + "-" + CStr(DatePart("yyyy",Now()))
 
Why not going with simpler:

"G:\Public\War Room\Published Reports\Master Spending " [blue]& Format(Date, "M-D-YY") &[/blue] ".pdf"



Have fun.

---- Andy
 
Okay, so it looks like VBA is how I need to go as I don't know a way to get the formats into the macro builder... One question tho.... been a long time..... and seem to be having problems writting the code...
Been looking for search for some help but getting more confused, guess things have really changed...
Can anyone please lend a hand?


Private Sub Command2_Click()
DoCmd.SetWarnings (WarningsOff)
DoCmd.OpenQuery "ClearCombined"
DoCmd.OpenQuery "ReceiverDetailWarRoom"
DoCmd.OpenQuery "GLDetailWarRoom"
DoCmd.SetWarnings (WarningsOn)
DoCmd.OpenReport "CombinedWarRoomReport", acViewPreview
DoCmd.OpenReport "CombinedWarRoomSuppliesReport", acViewPreview
DoCmd.OpenReport "CombinedWarRoomSafetyandEnviron", acViewPreview
DoCmd.OpenReport "CombinedWarRoomMaintReports", acViewPreview
DoCmd.SendObject acReport, CombinedWarRoomReport, .PDF, "me@work.com", , , "MTD Spending Report", "Attached is the current spending report MTD", No
Docmd.Save the file would go here........


Again, any help or a point in the right direction would be great!
 
For outputting a report, I use something similar to:
Code:
DoCmd.OutputTo acOutputReport, strReportName, "PDFFormat(*.pdf)", strFileName, False, "", , acExportQualityPrint
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top