Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jun 2003
    Location
    Camp Lejeune, North Carolina, USA
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Report form totaling fields within certain dates (2003)

    Ok Here we go. I need to create a report form from an existing database to total the number of entries for each of the 6 category names (mission, personal, medical, legal, career change, and other. This has to be able to be done for a specific date range i.e. 2008-01-07 thru 2008-01-10. I am mostly interested on the correct syntex for each and how to create the form with dates being pulled at the top of the report

    Thanks

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

    Re: Report form totaling fields within certain dates (2003)

    You can specify a grouping level for the report in the Sorting and Grouping dialog. To group on a field, you must select it in the Field/Expression column, and set either Group Header or Group Footer or both to Yes.
    In the group header or footer section, you can use expressions such as =Count(*) to display the number of records in that group.

    If you create a form with text boxes txtStartDate and txtEndDate, you can open the report from the form (for example in the On Click event of a command button). Code looks like this:
    <code>
    DoCmd.OpenReport "rptMyReport", acViewPreview, , "[DateField] Between #" & _
    Format(Me.txtStartDate, "mm/dd/yyyy") & "# And #" & Format(Me.txtEndDate, "mm/dd/yyyy") & "#"
    </code>
    Substitute the actual names.
    You can place a text box on the form with control source
    <code>
    =[Forms]![NameOfForm]![txtStartDate]
    </code>
    and another one for the end date. Or a text box with a control source like this:
    <code>
    ="From " & Format(Me.txtStartDate, "yyyy-mm-dd") & " to " & Format(Me.txtEndDate, "yyyy-mm-dd")</code>

Posting Permissions

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