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

Specify Filepath for .snp save

Status
Not open for further replies.

mrf1xa

Technical User
Jan 14, 2002
366
GB
Hi there

I am using the code below to create snapshot images of certain Access reports as it seems to be the only way to email them without loss of formatting. In fact it works pretty well.

Public Function Snapshot(strReport As String)

'****Creates a Snapshot view of the chosen report, viewable using Snapshot viewer and which can be emailed without**
'****loss of colour or format. To call this function use: Call Snapshot("Name of report")***************************

Dim str As String
Dim msg As String

'Create string for report name consisting of: User ID, report name (minus the rpt prefix) + current date + .snp suffix
str = Forms![frmLogon]![ResID] & " " & Right(strReport, Len(strReport) - 3) & " " & DatePart("d", Date) & "." _
& DatePart("m", Date) & "." & DatePart("YYYY", Date) & ".snp"

'Output report content in Snapshot format and open Snapshot viewer
DoCmd.OutputTo acReport, strReport, acFormatSNP, str, -1

'Message the user to tell them the name of their report
msg = MsgBox("Your report has been created and saved under the name:" & vbNewLine & str, vbInformation + vbOKOnly, _
"REPORT CREATION SUCCESSFUL")

'Bring the snapshot viewer to the front so user can see how their report will look.
AppActivate "Snapshot Viewer"

End Function

However, the current code chooses where it will save the .snp file. On my networked PC at the office this is to the same folder as the db resides in, whilst on my laptop it goes to My Documents.

My question is, can I specify where it should go? Ideally it would go to the local C:\ under the users name- somehting like C:\Fred Database Reports, and create this folder if it does not already exist.

Thanks in advance

Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
Won't the following work for your string
Code:
str
?

Code:
'Create string for report name consisting of: User ID, report name (minus the rpt prefix) + current date + .snp suffix
    str = "C:\Fred Database Reports\" & Forms![frmLogon]![ResID] & " " & Right(strReport, Len(strReport) - 3) & " " & DatePart("d", Date) & "." _
    & DatePart("m", Date) & "." & DatePart("YYYY", Date) & ".snp"
[pc2]
 
Apologies for the delay, only just been able to try this out.

Sorry to say it produces an error message saying:

"Report Snapshot was not created as you do not have sufficiant disk space to create temporary files"

Swapping back to the old code works fine. Any ideas why this might be?

Thanks Nigel
Didn't someone say work is supposed to be fun? They didn't have computers then I guess....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top