Results 1 to 7 of 7

Thread: Parameter Entry

  1. #1
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Parameter Entry

    I'm trying to follow the example in the Access97 Help file for entering Start/Stop dates in a query and then running a report with those dates displayed in the report header. The control source for the report is a query that requests entry of parameters for the start and end dates. I put controls in the report header to print the start and end dates. However, when I run the report it asks for entry of the start and end dates twice -- seemingly once for the query and once for the report. Why is the report requesting these entries instead of simply printing them in the header?

    I must be missing something here, and any help is most welcome.

  2. #2
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    USA
    Posts
    379
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Parameter Entry

    I am accustomed to getting the results you desire by placing the criteria as unbound text boxes on a dialog form.

    You can find this is Help under criteria, reports, then Use a form to enter report criteria. This method has always worked for me.

    Maybe someone else has used the method you are describing ...

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    La Verne, California, USA
    Posts
    313
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Parameter Entry

    Chuck,

    Be sure to use the exact same spelling in the DATA SOURCE of the Text Box you are using on the report as you have in the underlying query criteria fields. What is in the brackets must repeat verbatim in this reference and also be enclosed in brackets. I use this format:

    ="From"&" "&([Enter The Start Date])&" "&"To"&" "&([Enter The Ending Date])

    Be sure to start with an equals sign. Place quotes around fixed text.

    Hope this helps.

  4. #4
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Parameter Entry

    Well, I tried copying your expression directly into the criteria part of my query, and it bombed after entering the second date with an "expression too complicated" error message. Also, I'm curious, but why the parentheses around your bracketed parameter names? It seems redundant, but then I'm not very skilled at the syntax.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Parameter Entry

    The reason it does not work is that the query only returns records. It does not retyurn the instructions for selecting those records. Therefore when you base a report on the query it knows nothing of the start and end dates. As Thomas said, for the report to include the dates you would have to have them entered in a control in a form and then refer to them on the report as
    Forms!frmMyform!txtStartdate.value or some such. (I may not have the syntax quite right)
    David Grugeon
    Brisbane Australia

  6. #6
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    La Verne, California, USA
    Posts
    313
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Parameter Entry

    Chuck,

    I should have been more clear. In the query use the parameters in only the brackets. Assuming you have a field for a start date and one for an ending date you would put a criteria in for each.
    In the report would be a text box using the expression I first posted.

  7. #7
    Bronze Lounger
    Join Date
    Feb 2001
    Location
    Escondido, California, USA
    Posts
    1,458
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Parameter Entry

    Thanks for everyone's advice albeit I solved the problem a bit differently. As it turns out you can pass parameters from a query to a report. In the query criteria for the Date field I entered: Between [Start_Date] And [End_Date]. In the report header I entered controls referencing these two "fields" and when I run the report it asks for the two parameters, then displays the report with the two dates in the header. I thought I had tried this before, and it didn't work -- why it works now remains a mystery.

    Thanks again for the advice.

Posting Permissions

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