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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export SnapShot

Status
Not open for further replies.

pbrown2

Technical User
Jun 23, 2003
322
US
There is a report that needs to be exported on a daily basis. Currently, since the previous days must be kept, the export is being done manually so that the file name can change.
I.E.
DSR 21504
DSR 21404
DSR 21304

etc....

*The "21504" is an actual field [EFF DATE] in the DSR*

File path is set to:

I:\TC\FY03\DSR\FileName.SNP

Is there away to have a macro export the file and attach the value in [EFF DATE] to the end of the file so that it will create a new file and won't overwrite the existing file?

Or does anyone have any suggestions so that it will not overwrite the existing file....



Thank you for any and all help,

PBrown
 
Hi, this may be of use to you in concatenating strings for a file name. I included seconds in the example too which is a bit overkill but it works well for me in not over-writing files.

Private Sub CmdPlistSnp_Click()

On Error GoTo Err_CmdPlistSnp_Click

Dim SUS As String

SUS = Me.CboSus

Const conUserCancelledPrint = 2501

DoCmd.OutputTo acOutputReport, "rptPunchlistCustom", acFormatSNP, "C:\Snapshots\" & SUS & " System Punchlist" & " - " & Format(Date, "mmmm dd") & ", " & Format(Time, "mm") & " Mins, " & Format(Time, "ss") & " Secs" & ".snp"
MsgBox "This file was output to C:\Snapshots & can be Identified by the Date Stamp"
Exit_CmdPlistSnp_Click:
Exit Sub

Err_CmdPlistSnp_Click:
If Err <> conUserCancelledPrint Then
MsgBox "This is usually caused by an incorrect location, not memory. If the db was moved to another server or job,give Admin a call."
End If
Resume Exit_CmdPlistSnp_Click
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top