Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Apr 2002
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi all

    Hope someone has an answer.

    I would like to include on my reports, as a footer filed, when the report was last modified. Is there a way in which this date, from the from properties, can be added to my report.

    Thanks

    toncc

  2. #2
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I hacked this one together from the help files. There has to be a more elegant way, but at least this will work.

    In the Report open event use:
    Code:
    Private Sub Report_Open(Cancel As Integer)
    	Dim rptCurrentReport As Report
    	Set rptCurrentReport = Screen.ActiveReport
    	Dim acobjLoop As AccessObject
    	For Each acobjLoop In CurrentProject.AllReports
     	If acobjLoop.Name = rptCurrentReport.Name Then
     	Me.lblMod.Caption = acobjLoop.DateModified
     	End If
    	Next acobjLoop
    End Sub

  3. #3
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts
    On further review - it will only work if the report is in design mode first then into preview. Sorry for any false hopes.

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    But the solution proposed is not far from working. How about this?

    Code:
    Public Function fnGetDateModified(strReport As String) As String
    	
    	Dim strDateModified As String
    	Dim acobjLoop As AccessObject
    	For Each acobjLoop In CurrentProject.AllReports
    	If acobjLoop.Name = strReport Then
     	'Debug.Print acobjLoop.DateModified
     	strDateModified = Format(acobjLoop.DateModified, "dd-mm-yyyy")
    	End If
    	Next acobjLoop
    	fnGetDateModified = strDateModified
    End Function
    Then in the on Open event of the report
    Code:
     Me.labelModified.Caption = fnGetDateModified(Me.Name)
    Regards
    John



  5. #5
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    I just want to make sure we are talking about the same thing here.
    Quote Originally Posted by toncc View Post
    I would like to include on my reports, as a footer filed, when the report was last modified.
    The solution proposed tells you when the design of the report was last changed, not when the data in the report was last changed. Is that what you really want?
    The design of the report may not have changed for years, but the data in it could be up todate.
    Regards
    John



  6. #6
    Lounger
    Join Date
    Apr 2002
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    G'Day,
    That is exactly what we want - primarily for Document Control purposes. What's more - just tested an it appears to be working! Thank you very much for your help, you'd be surprised how hard it was to actually find out how to do this.

    Only one small thing we changed as we have hundreds of reports...

    We replaced:
    strDateModified = Format(acobjLoop.DateModified, "dd-mm-yyyy")
    End If
    with

    strDateModified = Format(acobjLoop.DateModified, "dd-mm-yyyy")
    Exit For
    End If
    This way we exit the For... loop as soon as we find a match for the input report name.

    Cheers

Posting Permissions

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