Query Date Parameter Write in Report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ElTipo
    New Member
    • Jul 2007
    • 36

    Query Date Parameter Write in Report

    Hello People,

    Is possible to write in reporte a query parameter? example

    Between [Start date] and [End Date]

    I need to put in report the Start date and End Date if the user put this date range in the popup parameter.

    Is possible?
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32645

    #2
    You would add a filter to the report when you open it :
    Code:
    ...
      strWhere = "[DateField] Between #%F# And #%T#"
      strWhere = Replace(strWhere, "%F", Format(Me.FromDate, "m/d/yyyy"))
      strWhere = Replace(strWhere, "%T", Format(Me.ToDate, "m/d/yyyy"))
      Call DoCmd.OpenReport("ReportName", acViewNormal, ,strWhere)

    Comment

    • ElTipo
      New Member
      • Jul 2007
      • 36

      #3
      Thanks Again Neo,

      Is possible to write an SQL Code in the text box? If I create a textbox like

      =Min[Start Date] to Max[End Date]

      and this show the minimum and maximun for type user range.

      Sorry for my english.

      I try the code to view the result

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32645

        #4
        I'm afraid I don't understand what you're asking, but my code basically does what I think you're after.

        Me.FromDate & Me.ToDate refer to controls on your form (which can be TextBoxes).

        Comment

        Working...