Date on a report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jmar93
    New Member
    • Mar 2008
    • 46

    Date on a report

    I am using Access 2007. I will be producing a report based on a query that when run will ask for a beginning and ending date. Is there a way to make this date range display in the report header, like "1/1/07 - 3/3/07" or such?

    thanks,
    Jeff
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32656

    #2
    A better (and more standard) way to do this would be to design a form which would open the report.

    The date range would be enterable on the form and could be passed either in the Filter parameter or in the OpenArgs parameter.

    Remember the Me.OpenArgs value is reset to Null after the first line is executed in the Report_Open() procedure so save it first thing.

    Comment

    • jmar93
      New Member
      • Mar 2008
      • 46

      #3
      Originally posted by NeoPa
      A better (and more standard) way to do this would be to design a form which would open the report.

      The date range would be enterable on the form and could be passed either in the Filter parameter or in the OpenArgs parameter.

      Remember the Me.OpenArgs value is reset to Null after the first line is executed in the Report_Open() procedure so save it first thing.
      I have read about the OpenArgs parameter and I have to admit I don't understand how to use it.

      thanks,
      Jeff

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32656

        #4
        If you have a specific question I can help.

        I can probably lead you through it, but I won't do it all for you I'm afraid.

        Comment

        • jmar93
          New Member
          • Mar 2008
          • 46

          #5
          Originally posted by NeoPa
          If you have a specific question I can help.

          I can probably lead you through it, but I won't do it all for you I'm afraid.
          I have a report called rptBoardUsage that I open by first entering a beginning date and ending date in to a form called frmBoardUsageRe port. When I press the command button it opens the report and runs the query that fills the report. A text box on the report displays the beginning date, it's data control sorce is
          =[Forms]![frmBoardUsageRe port]![BegDate]. This works great until I set the frmBoardUsageRe port to close after the report opens, then a get the #name error.

          I have tried using the following code in the report open module:
          Code:
          Private Sub Report_Open(Cancel As Integer)
              DoCmd.OpenReport rptBoardUsage, Text18 = Forms!frmBoardUsageReport!BegDate
              DoCmd.OpenReport rptBoardUsage, Text20 = Forms!frmBoardUsageReport!EndDate
          End Sub
          But it dosen't work. All I want is to be able to have the frm close when the report opens and still have the dates appear on the report.

          thanks,
          Jeff

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32656

            #6
            Running late.

            I'll try to look at this for you tomorrow Jeff :)

            PS. In the mean-time, can you dig up and post the code you use to open the report for me.

            PPS. Remember to use the [ CODE ] tags provided ;)

            Comment

            • jmar93
              New Member
              • Mar 2008
              • 46

              #7
              Originally posted by NeoPa
              Running late.

              I'll try to look at this for you tomorrow Jeff :)

              PS. In the mean-time, can you dig up and post the code you use to open the report for me.

              PPS. Remember to use the [ CODE ] tags provided ;)
              I'm just opening the report with a macro using the on click property for the command button on the frmBoardUsageRe port.

              thanks,
              Jeff

              Comment

              • NeoPa
                Recognized Expert Moderator MVP
                • Oct 2006
                • 32656

                #8
                In that case I suggest you may want to convert that to using some VBA code.

                Not because macros don't work, but I don't know their limitations and I would never recommend using them.

                Lastly, I can't help you in an area I'm so unfamiliar with.

                Comment

                Working...