|
-
Jun 27th, 2000, 03:27 AM
#1
Thread Starter
Lively Member
I have some reports saved in an Access Database, and I need VB to print them. How do I get my VB app to find these reports and print or preview them?
-
Jun 27th, 2000, 09:05 AM
#2
Ok still testing code, but this is what i got
Make a reference to MS Access in the project.
Add the following code
'
' Setup reference to Access
'
Dim MSAcc As Access.Application
Set MSAcc = New Access.Application
'
' ok connect your database
'
MSAcc.OpenCurrentDatabase("c:\whatever.mdb")
' by default, the OpenReport method of the
' DoCmd object will send the report to the printer
'
MSAcc.DoCmd.OpenReport "MyReport"
' close the database
MSAcc.CloseCurrentDatabase
Still mucking around with this, but hope it gives you a guideline
That's about all it takes. Just remember
-
Jun 27th, 2000, 07:41 PM
#3
Thread Starter
Lively Member
Thanks, I can get that to do what I need. I also found that if I changed the OpenReport line to:
MSAcc.DoCmd.OpenReport "MyReport", 2
It will open in preview mode.
-
Jun 28th, 2000, 04:03 AM
#4
Cool delker didn't know that
Still playing with the code to keep our end user happy so will include your code with maybe a tick box or something to allow mode selection.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|