Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003

    Question Unanswered: Display first and last date

    I want to get a report to display the first and last date in a database

    TableData (data with dates 2/3/03 - 7/5/03)
    Report displays :
    Bla Bla Bla Data Data
    "from dates '2/3/03' to '7/5/03'"
    more data bla bla

    Next query has a different date range so it displays the first date in the range and last date

    I was thinking something along the lines of IIf(OldDate < NewDate, DisplayDate, DisplayDate=NewDate) and the reverse for the last date, but I am not sure how to get something like this displayed on the form correctly. I also dont know how to get it to check through all the dates for this check and it will prompt me for values that are not in the query/tables.

    any help would be appreciated
    thanks in advance

  2. #2
    Join Date
    Sep 2003
    Try using the Format event of the report header to obtain the date.

    What I did was assign a returned recordset value to a label caption:

    Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)
    Dim dtmTo As Date
    Dim rst As New ADODB.Recordset
    rst.Open "select max(DateSent) from DateSentRecd", CurrentProject.Connection, adOpenStatic, adLockReadOnly
    dtmFrom = rst(0)
    Me.lblTo.Caption = dtmTo

    End Sub

    You can use min instead of max for the date from.
    All code ADO/ADOX unless otherwise specified.

Posting Permissions

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