How to show "Modified Date" in report footer

  • Thread starter Thread starter DavPet
  • Start date Start date
D

DavPet

How can I show the modified date in a report's footer?
I am showing the report name in a text box as data = [Name] but data =
[Modified] doen't work.
 
in message:
How can I show the modified date in a report's footer?
I am showing the report name in a text box as data = [Name] but data =
[Modified] doen't work.

1. Copy/Paste this code into a new standard module:

'**************Code Start******************
Public Function GetObjProperty(ObjType As String, _
ObjName As String, prpName As String) As String

On Error GoTo ErrorPoint

GetObjProperty = CurrentDb.Containers(ObjType).Documents(ObjName).Properties(prpName)

ExitPoint:
Exit Function

ErrorPoint:
If Err.Number = 3270 Then GetObjProperty = vbNullString

End Function
'**************Code End******************

2. Compile the code and save the module as basObjectProperty

3. Create a unbound text box in the Report's Footer called
txtDateModified

4. In the Format event for the Footer place this code:

'**************Code Start******************
Private Sub PageFooter_Format(Cancel As Integer, FormatCount As Integer)
Dim varModified As Variant
Dim strReportName As String

strReportName = Me.Name
varModified = GetObjProperty("Reports", strReportName, "LastUpdated")

Me.txtDateModified = varModified
End Sub
'**************Code End******************

5. Save and close the report.

Then run it.
 
Worked great, thank you.

Jeff Conrad said:
in message:
How can I show the modified date in a report's footer?
I am showing the report name in a text box as data = [Name] but data =
[Modified] doen't work.

1. Copy/Paste this code into a new standard module:

'**************Code Start******************
Public Function GetObjProperty(ObjType As String, _
ObjName As String, prpName As String) As String

On Error GoTo ErrorPoint

GetObjProperty =
CurrentDb.Containers(ObjType).Documents(ObjName).Properties(prpName)

ExitPoint:
Exit Function

ErrorPoint:
If Err.Number = 3270 Then GetObjProperty = vbNullString

End Function
'**************Code End******************

2. Compile the code and save the module as basObjectProperty

3. Create a unbound text box in the Report's Footer called
txtDateModified

4. In the Format event for the Footer place this code:

'**************Code Start******************
Private Sub PageFooter_Format(Cancel As Integer, FormatCount As Integer)
Dim varModified As Variant
Dim strReportName As String

strReportName = Me.Name
varModified = GetObjProperty("Reports", strReportName, "LastUpdated")

Me.txtDateModified = varModified
End Sub
'**************Code End******************

5. Save and close the report.

Then run it.

--
Jeff Conrad
Access Junkie
http://home.bendbroadband.com/conradsystems/accessjunkie.html
http://www.access.qbuilt.com/html/articles.html
 
Back
Top