PDA

Click to See Complete Forum and Search --> : Print Access report in VB based on parameter query


Michael
Jun 22nd, 1999, 06:43 PM
I want to print an Access 97 report in VB6. The report is based on a query which takes one parameter.

At the moment, Access prompts me for the parameter. How can I give the query the value of the parameter using VB code? The value of the parameter is held in a variable which was determined earlier. I don't want any user interaction during this process.

I am using VB6, Access 97, and Jet/DAO.

Thanks in advance.

[This message has been edited by Michael (edited 06-23-1999).]

linda117
Jun 27th, 1999, 01:17 PM
hello Michael...

i know...i also new on this but i think i've the answer about your problem. actually i also face the same problem as yours... & i've been looking for the answer at this site...& here is the solution... hope it will help...

Dim accApp=New Access.Application
accapp.openCurrentDatabase(App.Path & "\databasename.mdb")

reportname="yourreportname"

accApp.DoCmd.OpenReport reportname,acViewNormal

accApp.CloseCurrentDatabase

Set accApp=Nothing

-linda-



------------------

..what we have to learn to do
....we learn by doing

Michael
Jun 27th, 1999, 05:01 PM
Hi Linda

Thanks for your efforts in trying to solve my problem.

The solution that you suggest works fine if the underlying query has no parameters - I have used it a few times.

The problem arises when the underlying query has a parameter. How do I get the parameter into the query via the report.