A good way to run a MicrosoftAccess report in VB

Source: Internet
Author: User

A good way to run a MicrosoftAccess report in VB

In VB, how to use intuitive and simple reports has always been a concern of many people. CrystalReports is not ideal for use. This section describes how to run a Microsoft Access Report in VB.

Use Automation to run a MicrosoftAccess report

1. Use Microsoft Access to create relevant reports (such as rptEmployess) for databases (such as novelty. mdb ).

2. Create a reference

Use the "ProjectReferences" menu in VB to create a reference to the MicrosoftAccess8.0ObjectLibrary.

3. program list

'Referencesmsaccess8. 0 ObjectLibrary (this

'Codewillworkwithanyversonofaccessthat

'Ortsausautomation)

DimMSAccessAsAccess. Application

Privatesubcommand#click ()

SetMSAccess = NEWAccess. Application

MSAccess. OpenCurrentDatabase (App. Path & "ovelty. mdb ")

MSAccess. DoCmd. OpenReport "rptEmployess", acViewNormal

MSAccess. closecurspondatabase

SetMSAccess = Nothing

EndSub

Note: acViewNormal informs Access to open the report and print it immediately.

This method has the disadvantage that MSAccess must be installed in the runtime environment. ->

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.