Public Function SaveSNP()
On Error GoTo Err_SaveSNP
Dim obj As AccessObject
Dim dbs As Object
Dim strRptName As String
Dim strSnpName As String
Dim strSnpshot As String
Dim strPath As String
AddReferenceMSODLL
strPath = GetFolderPath
If Right(strPath, 1) <> "\" Then
strPath = strPath & "\"
End If
Debug.Print "strPath = " & strPath
Set dbs = Application.CurrentProject
For Each obj In dbs.AllReports
If obj.IsLoaded = True Then
strRptName = obj.Name
Select Case MsgBox("Click ""Yes"" to use the Report name. " _
& vbCrLf & "" _
& vbCrLf & "Click ""No"" to enter a different name." _
, vbYesNo Or vbQuestion Or vbDefaultButton1, _
" Use Report Name?")
Case vbYes
strSnpName = strRptName
Case vbNo
strSnpshot = InputBox(" " & _
" Please enter a name for your Snapshot. ")
If Len(strSnpshot & "") > 0 Then
strSnpName = strSnpshot
Else
strSnpName = strRptName
End If
End Select
If Right(strSnpName, 4) <> ".snp" Then
strSnpName = strSnpName & ".snp"
Else
End If
Debug.Print "strSnpName = " & strSnpName
DoCmd.OutputTo ObjectType:=acOutputReport, ObjectName:=strRptName, _
OutputFormat:=acFormatSNP, OutputFile:=strPath & strSnpName
End If
Next obj
Set obj = Nothing
Set dbs = Nothing
Exit_SaveSNP:
Exit Function
Err_SaveSNP:
Call MsgBox(Err.Description & vbCrLf & "Error Number: " & Err.Number & vbCrLf & _
" In procedure SaveSNP of Module basRptSnapshot")
Resume Exit_SaveSNP
End Function