My database is in Access, so can my vb program call an Access report??????? If it's possible, how is it done? Someone help me purrleease..........
Printable View
My database is in Access, so can my vb program call an Access report??????? If it's possible, how is it done? Someone help me purrleease..........
If you want to print a report created in MS Access
using your VB application, then its your lucky day.
I've got this in this forum... but forgot the thread no.
or the person who send it. Many of us tried this... and
this really work. here's the code:
' From the book Database Access With VB6
' by Jeffery Mcmanus..
' you need your access ref obj lib
Dim MSACCESS as Access.application
Private Sub PrintReport_Click()
Set MSACCESS = New Access.Application
MSACCESS.OpenCurrentDatabase ("c:\your dir\Your.mdb")
'This opens your db..
MSACCESS.DoCmd.OpenReport "YourReportHere", acViewNormal
'This actualy opens your report from your Access (97?)
'db & then prints it..
MSACCESS.CloseCurrentDatabase ' self explanitory
Set MSACCESS = Nothing
' You need this,
' or you will keep access in memory & lag the user..
The above only works if the machine the program is running on has Access installed, if that matters to you.
thanks a million rod for the codes. u too edneeis.
yup... there's access installed in the machine. But just for curiosity, what if access resides in the server???
You can create the object on the server by using the CreateObject function.
CreateObject(class,[servername])
MSDN -- CreateObject Function:
http://msdn.microsoft.com/library/de...eateObject.htm
If you don't have Access installed on the target machine, you can use a product from Videosoft called VS Reports
It is an add in OCX control that lets you distribute an app with Access reports to clients who don't have Access installed...
It works pretty well on the one app I have tried it on here at work.
Liz, why didn't you just use the reporting capability of VB?
Another neat trick is to report the data in HTML format. That way the results could be posted to a shared drive for all (at least those with a browser and access to the drive) to see. That could save a lot of trees from being sacrificed to the report gods.