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. ->