Hi Everybody
How can I run a report from Ms Access 97 in a VB 6 application?
Thanks for the Info
Clyde
Printable View
Hi Everybody
How can I run a report from Ms Access 97 in a VB 6 application?
Thanks for the Info
Clyde
this should do it - the "id = 5" bit means it will only print the report for any records where the id field (a field called id) is = 5
the acNormal bit means it will print, acPreview means just view
get back to me if this does not help
Dim stDocName As String
Dim accApp As Access.Application
Set accApp = New Access.Application
accApp.OpenCurrentDatabase (App.Path & "\database.mdb")
stDocName = "My Access Report"
accApp.DoCmd.OpenReport stDocName, acNormal, , _
"ID = 5" 'add query statement here if you want
accApp.CloseCurrentDatabase
I don't know if you can do that - you would need the MSAccess 8.0 object on your system. If you can get that without installing Access then you probably can. Although any time you open a report in Access (even just to print it) it opens Access itself for a second. So no would be my final guess. You could always use the new report designer in VB6.0 - it is similar to Access, but none of the handy wizards. Thems are my thoughts for what they are worth.