Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Viewing Access Report in VB6

Status
Not open for further replies.

VBApprentice

Programmer
Oct 4, 2001
14
US
I am having a problem viewing a Access (2000) report in VB6.
I want to be able to view the report before printing it.
The code to print works fine but when I put in the constant
to view the report nothing happens. Is there something that is wrong
or missing with this code? This occurrs on a 95, ME and NT machine.

The code:
Dim appAccess As Object
Set appAccess = CreateObject("Access.Application")
appAccess.OpenCurrentDatabase (C:\test\test.mdb)

'********************************************************
'Access constants
'acNormal - Print (default)
'acPreview - Print Preview
'acDesign - Design Edit Mode
'********************************************************
appAccess.DoCmd.OpenReport "TestReport", acNormal
appAccess.Quit ' not used for acPreview
Set appAccess = Nothing
 
Hi VBApprentice, You have to make the instance of Access explicitly visible:
appAccess.DoCmd.OpenReport "TestReport", acPreview
appAccess.Visible = True

Good Luck, MLK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top