In VB how to use intuitive, simple report has been a lot of people concerned about the problem, crystalreports use is not very ideal. This paper introduces a method of running MicrosoftAccess report in VB, which is good to use.
Using Automation to run MicrosoftAccess reports
1. Use MicrosoftAccess to establish a database (e.g., NOVELTY.MDB) related reports (such as: rptemployess).
2. Create a reference
Use the "Projectreferences" menu in VB to create a reference to Microsoftaccess8.0objectlibrary.
3. List of procedures
' Referencesmsaccess8.0objectlibrary (this
' Codewillworkwithanyversonofaccessthat
' Supportsautomation)
Dimmsaccessasaccess.application
Privatesubcommand1_click ()
Setmsaccess=newaccess.application
Msaccess.opencurrentdatabase (app.path& "Ovelty.mdb")
MSAccess.DoCmd.OpenReport "Rptemployess", acViewNormal
Msaccess.closecurrentdatabase
Setmsaccess=nothing
Endsub
Note: acViewNormal tells access to open the report and print it immediately.
The disadvantage of this approach is that the operating environment must be fitted with msaccess. ->