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....
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....