Results 1 to 3 of 3

Thread: Print Access report in VB based on parameter query

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Leicester, UK
    Posts
    123

    Post

    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).]

  2. #2
    New Member
    Join Date
    Jun 1999
    Location
    Johor Bahru, Johor, Malaysia
    Posts
    4

    Post

    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

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Leicester, UK
    Posts
    123

    Post

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width