How to call the Access Report from VB6?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I got a VB 6 application in my office and I need to pass 2 parameters from VB
form to the Access 2002 report. How could I pass the parameters to the
Access and activite the Access Report?
 
Insert a reference to a Acces (Tools, References, Microsoft Access...)

Access.OpenCurrentDatabase "C:\DatabaseName.mdb"
Access.DoCmd.OpenReport "ReportName", acViewNormal, "FilterCondition"
Access.CloseCurrentDatabase

Hope this help.
Note: I need some help with the FilterCondicition parameter, in my VBA
software I can not use a condition like "[Field1]>25" therefore the report
always print all the records
 
Reviwing my reply post I realize that I forget a comma (",") between
acViewNormal and the FilterCondition, the right syntax is:

Access.DoCmd.OpenReport "ReportName", acViewNormal,,"FilterCondition"

However I continues having the problem of Ignoring the Filter in VBA

Is there anybody that knows how to pass the last parameter (Filtercondition)
in VBA?

Thanks,

Harold
 
Here is my understanding, on the VB6 form,

--Insert a reference to a Acces (Tools, References, Microsoft Access...)

Access.OpenCurrentDatabase "C:\DatabaseName.mdb"
Access.DoCmd.OpenReport "ReportName", acViewNormal,,"FilterCondition"
Access.CloseCurrentDatabas
 
I think it's covered somewhere in the following KB articles:

ACC: How to Use Automation to Print Microsoft Access Reports:
http://support.microsoft.com/?id=145707
ACC2000: How to Use Automation to Print Microsoft Access Reports
http://support.microsoft.com/?id=210132
ACC2002: How to Use Automation to Print Microsoft Access Reports
http://support.microsoft.com/?id=296586
ACC: Using Microsoft Access as an Automation Server
http://support.microsoft.com/?id=147816
ACC2000: Using Microsoft Access as an Automation Server
http://support.microsoft.com/?id=210111
 
Back
Top