Visual Basic > Database SQL Stuff
Preview an Access Database Report
Preview an Access Database Report The function below can be used to preview a report created in MS Access. 'Purpose : Preview an Access Report from VB 'Inputs : sAccessDBPath The path and filename of the access database containing the report to show ' sReportName The name of the report to show 'Outputs : Returns an empty string on success, else returns an error message. Function AccessShowReport(sAccessDBPath As String, sReportName As String) As String Dim oAccess As Object 'Access.Application On Error GoTo ErrFailed AccessShowReport = "" 'Create Access Set oAccess = CreateObject("Access.Application") 'Open Database oAccess.OpenCurrentDatabase sAccessDBPath 'Open report oAccess.DoCmd.OpenReport sReportName, 0 'acViewNormal 'Show Access Report oAccess.Visible = True oAccess.CloseCurrentDatabase Set oAccess = Nothing Exit Function ErrFailed: Debug.Print Err.Description Debug.Assert False AccessShowReport = Err.Description If oAccess Is Nothing = False Then oAccess.CloseCurrentDatabase Set oAccess = Nothing End If End Function
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows