Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: How to display the data ranged entered to the report

    I have a query that need user to enter the Start date and the End date. I would like to show the date range on the report. How could I do? As if using textboxes, i may retrieve the date range. If just the query asks user to enter the date range. How to retrieve the dates and display in the report. Thanks.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Dead easy* - just set the control source of the text box on the report to something like:
    Code:
    =forms!myForm!startDate
    * I think - I haven't done it for about two years. Perhaps I really should stop posting on the Access forum based just on my failing memory.

  3. #3
    Join Date
    Mar 2004
    Posts
    660
    I don't have a form but a report. The report is based on the query that has a filed criteria Between [Enter 1st date] And [Enter last date]. I don't get it why come from a form. Sorry, can you explain. I don't have a text box. Thanks.

  4. #4
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Check the code bank for a sample on how to do the date criteria based on a form. There's a few good examples there on how to do it with a form and this is personally how I'd set up the criteria for a report.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Me too.

    However, I think you can just use a text box on the report with a Control Source set to =[Enter 1st date] to display entered parameter values. Been a while since I fiddled with that though :\
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Quote Originally Posted by yyu
    I have a query that need user to enter the Start date and the End date. I would like to show the date range on the report. How could I do? As if using textboxes, i may retrieve the date range. If just the query asks user to enter the date range. How to retrieve the dates and display in the report. Thanks.

    For this I created a Form with the DateFields, then I placed the below line in the ReportHeader.

    Code:
    ="From    " & [EnterBeginningDate] & "   Through   " & [EnterEndingDate]
    Have a Happy New Year
    BUD
    Last edited by Bud; 01-05-08 at 04:17.

  7. #7
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by yyu
    I don't have a form but a report. The report is based on the query that has a filed criteria Between [Enter 1st date] And [Enter last date]. I don't get it why come from a form. Sorry, can you explain. I don't have a text box. Thanks.
    Ah - then you can't trap that. You'll have to go with one of the suggestions from the others. Something in the way you run this report will have to change.

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    probably smarter to use a parameter rather than asking for the date at run time..... you are leaving yourself open to bad data, or mistyping. For something like a commission report I'd expect it to be run on accounting periods

    what you could do is apply a filter as part of the reports opening
    you could pull the report date bracket in form another form (Ive used a technique of setting accounting report parameters in one form, setting values in the switchboard/main menu or if you prefer an reporting period class and then pulled those values as required in subsequent reports and forms).. sounds commplex, but in reality it isn't, but it does need a bit of thought and graft to make the settings work

    the main advantage is that users only have to set the parameters once for any one given run of the period reporting, there are no consistency errors because someone mistyped the date between runs or the report suite.

    you can use the values in the switchboard/main menu as part of your query.. replacing the [Enter 1st date] with forms!<myswitchboard/menuname>!<mycontrolvalue>

    etc...

  9. #9
    Join Date
    Mar 2004
    Posts
    660
    Quote Originally Posted by Bud
    For this I created a Form with the DateFields, then I placed the below line in the ReportHeader.

    Code:
    ="From    " & [EnterBeginningDate] & "   Through   " & [EnterEndingDate]
    Have a Happy New Year
    BUD
    Thanks. This works. So use the same prompt with query, e.g. [EnterBeginningDate] this is used in Query. On the report, just use the same prompt. It will display what the dates user enter. Thanks.

Posting Permissions

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