Click to See Complete Forum and Search --> : From VB6 code call a report designed in MS-Access


vuhongviet
September 17th, 2001, 11:21 PM
I designed some report templates inside MS-Access 2000, so I'd like call and display them inside my program that written in Visual Basic 6.0. How to do this ?

dcaillouet
September 18th, 2001, 01:16 AM
I have never done this so I can't tell you how. But if this was my problem I would look at using the Microsoft Snapshot Viewer OCX as a possible solution.

(While previewing this post, the following hyperlink did not highlight properly. You'll have to highlight it then cut-and-paste into your URL address bar)

http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q175274

robby bassic
September 18th, 2001, 02:01 AM
'// Reference:- MS-Access 9.0 Object Library

Dim appAccess As Access.Application
Set appAccess = New Access.Application
appAccess.OpenCurrentDatabase ("Path of your DB")
appAccess.DoCmd.OpenReport "Report Name", acPreview, , strYourCriteriaOptional
appAccess.DoCmd.OutputTo acOutputReport, "Report Name", acFormatSNP, "c:\temp.snp", True
appAccess.Quit
Set appAccess = Nothing

'//The line with "c:\temp.snp" is where it will save the Snapshot, If you really want to save it, you can change the name and path.
'// I save it to a temp file because I have no use for it, so it gets deleted each time I run a report.