PC User
Registered User.
- Local time
- Today, 15:22
- Joined
- Jul 28, 2002
- Messages
- 193
I've tried to debug and track down the source of this error, but I can't figure it our. I've researched access forums for something similar, but had no luck. Can someone help me with this code error?
Thanks,
PC
Code:
Public Function OpenSnapReport(ReportName As String, Optional View As Integer, Optional _
FilterName As String, Optional WhereCondition As String, Optional Prompt As Boolean = False, Optional Preview As Boolean = False)
On Error GoTo Whoops
'What are all the things you want to do with a report?
'Print it,Save it with prompt'Save it in db directory,Save it in db directory and Preview it
'you can filter before using
Dim rep As Report
Dim FName As String
'open report window
'should run any load event code
DoCmd.OpenReport ReportName, View, FilterName, WhereCondition
'DoCmd.OpenForm "", acNormal
'set rep as report
Set rep = Reports.Item(ReportName)
'make report invisible
rep.Visible = False
'set filter
If gstrFilter <> "" Then
rep.Filter = gstrFilter
rep.FilterOn = True
Else
rep.Filter = ""
rep.FilterOn = False
End If
'set orderby
If gstrOrderBy <> "" Then
Debug.Print gstrOrderBy
rep.OrderByOn = True
rep.OrderBy = gstrOrderBy
Else
rep.OrderBy = ""
rep.OrderByOn = False
End If
'If not printing
If View <> acNormal Then
'Pompt?
'If not set path for db dir
If Prompt = True Then
FName = vbNullString
Else
FName = CurrentDBDir & rep.Name & ".snp"
'FName = fGetSpecialFolderLocation(&H5) & "\" & rep.Name & ".snp"
End If
'export to snapshot viewer
'DoCmd.OutputTo objecttype[, objectname][, outputformat][, outputfile][, autostart][, templatefile]
DoCmd.OutputTo acReport, rep.Name, "Snapshot Format", FName, Preview
'DoCmd.OutputTo acOutputReport, rep.Name, acFormatSNP, FName, True
DoEvents
DoCmd.Close acReport, rep.Name
Set rep = Nothing
End If
OffRamp:
Exit Function
Whoops:
MsgBox "Error #" & Err & ": " & Err.Description
Resume OffRamp
End Function
PC
Last edited: