save as snp-report towards a file (using variable to name ans locateit)

G

geert

Hello

In my database I use a select case-tree with a "DoCmd.SendObject"
function resulting in sending a snp formatted mail.
I want to add also a 'save as' function.
I want to save my result (a snapshot format) on a specific directory
such as when I have:
Case "Eric"
Case "John"
that it will be saved under the directory Eric, etc.
I also want to give my snp a name in function on a variable (Client) I
determined earlier
eg. pbsuject1 = rs1.Fields("Client").

Can someone help me?

Thanks
Geert
 
H

hunterpaw via AccessMonster.com

geert said:
Hello

In my database I use a select case-tree with a "DoCmd.SendObject"
function resulting in sending a snp formatted mail.
I want to add also a 'save as' function.
I want to save my result (a snapshot format) on a specific directory
such as when I have:
Case "Eric"
Case "John"
that it will be saved under the directory Eric, etc.
I also want to give my snp a name in function on a variable (Client) I
determined earlier
eg. pbsuject1 = rs1.Fields("Client").

Can someone help me?

Thanks
Geert


Hi geert,

Perhaps this will get you started:

Sub SaveReportSnp()

Dim strRptName As String
Dim strPath As String
Dim strName As String
Dim pbsuject1 As String

' This is the Original Name of the Report
strRptName = "NameofReport"

' The first part of the path
strPath = "C:\Reports\"

pbsuject1 = rs1.Fields("Client")
' Add the ending .snp to the snapshot file name
pbsuject1 = pbsuject1 & ".snp"

' You have to add your own code
' here to provide the name
strName = "Eric"

' Add the final folder name to the strPath
' These folders must already exist for the code to work
Select Case strName
Case "Eric"
strPath = strPath & "Eric\"
Case "John"
strPath = strPath & "John\"
End Select

' Save the Report as a Snapshot
DoCmd.OutputTo ObjectType:=acOutputReport, ObjectName:=strRptName, _
OutputFormat:=acFormatSNP, OutputFile:=strPath & pbsuject1

End Sub

Best Regards,
Patrick Wood
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top