Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Feb 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Reports: Automatically enter query info (Access 2002)

    I have a report where I enter query paramaters into a form that generates the report. The report is a monthly report that is done a month after the activity has taken place. (ie: In March, I run the Monthly Report for February)
    What I want to know is if there is a way that I can automatically enter my query parameters into the header of the report.

    Any help would be greatly appreciated!

    Thanks! : )

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Reports: Automatically enter query info (Access 2002)

    You can create a text box in the report header with Control Source like this:

    =[Forms]![frmSelection]![txtMonth]

    or

    ="Activity Report for " & [Forms]![frmSelection]![txtMonth]

    where [Forms]![frmSelection]![txtMonth] is the parameter exactly as used in the query. Note: the form must still be open for this to work.

  3. #3
    New Lounger
    Join Date
    Feb 2005
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Reports: Automatically enter query info (Access 2002)

    Hans,

    Thanks for the quick response to both questions. However, in this case, the form is just a small form where you enter the dates and click "Ok" or "Cancel", then the form dissappears, and the report opens. Any ideas?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Reports: Automatically enter query info (Access 2002)

    I would recommend keeping the form open; if you don't want the user to see it, you can hide it by setting its Visible property to False. You can close the form in the On Close event of the report.

    Otherwise, you'd have to set global variables to the values of the parameters, but that's a) much more work and [img]/forums/images/smilies/cool.gif[/img] more error-prone.

Posting Permissions

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