Month Parameter Report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lebbsy
    New Member
    • May 2007
    • 55

    Month Parameter Report

    Please help me with a parameter report that allows one to input a month in words i.e. May, and displays values for that particular month only.

    Regards,
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    Where do you want help?

    Comment

    • Lebbsy
      New Member
      • May 2007
      • 55

      #3
      All I am trying to know for now is the logic of how I can go about creating a date parameter report that asks for a month in words (as a drop down list) and on selecting the particular month e.g. May, data related to the month (e.g. anything with 05) will be returned.

      Please help.....

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        That makes more sense to me :)

        Form
        Design with a control to select your month on, and a control (possibly Command Button) that triggers running the report.

        Report
        Design bound to a query. The design should be to allow all records to show. We will deal with filtering for the desired range in the code.

        Code
        Behind the Command button. This will invoke the report (DoCmd.OpenRepor t) but will pass a filter string in the call.

        The string will be created in the code, similar to the following :
        Code:
        Private Sub cmdButton_Click()
            Dim strFilter as string
            Dim datStart As Date, datEnd As Date
        
            datMonth = CDate(Me.txtMonth)
            datEnd = DateAdd("m", 1, datStart) - 1
            strFilter = "[DateField] Between " & _
                        Format(datStart, "\#d/m/yyyy\#") & _
                        " And " & _
                        Format(datEnd, "\#d/m/yyyy\#")
            Call DoCmd.OpenReport(ReportName:="YourReport", _
                                  WhereCondition:=strFilter)
        End Sub

        Comment

        • Lebbsy
          New Member
          • May 2007
          • 55

          #5
          Thanks a lot. Will tell you on my progress so let me try implementing it this way.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32633

            #6
            Let us know if you have any trouble with that.

            Comment

            Working...