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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying and Access Report Using VB? 1

Status
Not open for further replies.

timoteo

Technical User
Sep 17, 2002
72
US
Can I connect to and display an MS Access report in a VB application. I know how to connect to a table and am wondering if I can do a similar thing with a report because I find the DataReport included with VB difficult to use.

Thanks in advance for any assistance!

Timoteo
 
In short yes.

First add a reference in your project to the Microsoft Access Object Library via the Project-references menu.

Second, declare the access application object.

Code:
Dim objAccAppl As Access.Application

Third, add the following code

Code:
Set objAccAppl = GetObject(&quot;<path to database>&quot;)
objAccAppl.DoCmd.OpenReport &quot;<report name>&quot;,acViewNormal


Take Care,

zemp
 
zemp,

Thanks for the help. You have opened a whole new world of VB for me!

Just one follow up question if I may. Is there a way to display a report for review before printing it?

Timotoe
 
You should be able to change the 'acViewNormal' option to one that allows a preview. Check which options Access has.


Take Care,

zemp
 
zemp,

Thanks again, I should have thought of this myself. The parameter is acViewPreview.

Timoteo
 
Hi all,
does any body know how can I change Icon and windows title in Access preview page when I display preview from VB.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top