Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Using parameters with reports

Discussion in 'Information Technology' started by Alex, Jul 28, 2006.

  1. Alex

    Alex
    Expand Collapse
    Guest

    Used the instructions here:
    http://office.microsoft.com/en-us/assistance/HA011170771033.aspx
    to create a report that uses a form to feed parameters to a query that
    outputs a report. Here's how it works:

    -You open the report.
    -Access processes the code attached to the report's Open event.
    -That code opens a form that serves to collect the parameters.
    -You enter the parameters and click OK.
    -Access hides the form, but the form does not close.
    -Access then processes the report's underlying query.
    -That query retrieves parameters from the controls on the form that is
    currently hidden, does its work, and then delivers its results to the report.
    -The report finishes, and displays its results.
    -When you close the report, code in the report's Close event also closes the
    hidden form.

    My issue is that the underlying query stays open after closing the report.
    What do I need to do to have query close as well?
     
  2. Loading...


  3. Brendan Reynolds

    Brendan Reynolds
    Expand Collapse
    Guest

    Find the line of code that opens the query, and either delete it or comment
    it out. (Comment it out to begin with, at least until you've tested and are
    sure that you have commented out the right line of code. You can always
    delete it afterwards.) The query does not need to be open, that was just an
    intermediate step in the example.

    The line you're looking for looks something like this ...

    DoCmd.OpenQuery "Sales By Category Query", acViewNormal, acEdit

    (You may have changed the name of the query).

    --
    Brendan Reynolds
    Access MVP


    "Alex" <Alex@discussions.microsoft.com> wrote in message
    news:BB05C516-2665-4DC6-8DBD-9997C4CD8748@microsoft.com...
    > Used the instructions here:
    > http://office.microsoft.com/en-us/assistance/HA011170771033.aspx
    > to create a report that uses a form to feed parameters to a query that
    > outputs a report. Here's how it works:
    >
    > -You open the report.
    > -Access processes the code attached to the report's Open event.
    > -That code opens a form that serves to collect the parameters.
    > -You enter the parameters and click OK.
    > -Access hides the form, but the form does not close.
    > -Access then processes the report's underlying query.
    > -That query retrieves parameters from the controls on the form that is
    > currently hidden, does its work, and then delivers its results to the
    > report.
    > -The report finishes, and displays its results.
    > -When you close the report, code in the report's Close event also closes
    > the
    > hidden form.
    >
    > My issue is that the underlying query stays open after closing the report.
    > What do I need to do to have query close as well?
     

Share This Page