Welcome to SPN

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

Sign Up Now!

Re: Easy Date Range For Report

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

  1. Adnan

    Expand Collapse

    Thnak you Fred, your posted option 2) has helped me, too. I love it - Ones
    Please post all your inquiries on this community so we can all benefit -
    Thank you!

    "fredg" wrote:

    > On Tue, 9 Aug 2005 08:45:13 -0700, DianaS wrote:
    > > Hi,
    > >
    > > I would like to make it very easy for users to control the date range of a
    > > report. Is there a way I can create a simple form or text boxes in my report
    > > for entry of the date range by the user? For example "StartDate" and
    > > "EndDate" textboxes in my report. I want to avoid having users enter date
    > > ranges in the actual query.
    > >
    > > Alternate solutions also appreciated.
    > >
    > > Thanks,
    > > Diana

    > 1) If you are using a query as record source for the report, an easy
    > method is to have the query prompt for the date range.
    > On the Criteria line of the date field in the query, write:
    > Between [Start Date] and [End Date]
    > If you also wish to show the entered date range in the report, add an
    > unbound control to the report header.
    > Set it's Control Source to something like:
    > ="For sales between " & [Start Date] & " and " [End Date]
    > Note... the text inside the brackets must be identical to the
    > bracketed text in the query.
    > 2) A better method would be to use a form to enter the date range in.
    > Create an unbound form. Add 2 Text Controls.
    > Name one StartDate and the 2nd EndDate.
    > Add a command button.
    > Code the button's click event:
    > Me.Visible = False
    > Name this form 'ParamForm'.
    > In the query that is the record source for the report, in it's Date
    > field's criteria line, write:
    > Between forms!ParamForm!StartDate AND forms!ParamForm!EndDate
    > Next, code the main report's Open event:
    > DoCmd.OpenForm "ParamForm", , , , , acDialog
    > Code the main report's Close event:
    > DoCmd.Close acForm, "ParamForm"
    > When ready to run the report, open the report. The form will display
    > and wait for the entry of the dates. Click the command button and the
    > report will run without need for any further parameter entries. When
    > the report closes, it will close the form.
    > If you wish to display the parameters in the report, set the control
    > source of the unbound control to:
    > = For sales between " & forms!ParamForm!StartDate & " and " &
    > forms!ParamForm!EndDate
    > --
    > Fred
    > Please only reply to this newsgroup.
    > I do not reply to personal email.
  2. Loading...

    Similar Threads Forum Date
    Why Its Easy To Be A Sikh And The Master Of Puppets Blogs Oct 17, 2015
    Easy, Develop Another Addiction! Blogs Oct 16, 2015
    How To Conquer The World: Easy (by The Poet Warrior) Sikh Youth Feb 23, 2013
    USA Not Easy To Divide Wisconsin Sikh Gurdwara Shooting Donations Breaking News Sep 6, 2012
    Opinion Human Evolution: No Easy Fix Breaking News Oct 5, 2011

Since you're here... we have a small favor to ask...     Become a Supporter      ::     Make a Contribution     

Share This Page