Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Would like to put DateCreated and LastUpdated in a report

Status
Not open for further replies.

gmgrace

Technical User
Dec 7, 2001
10
US
I cannot figure out how to put object properties "DateCreated" and "LastUpdate" in a report footer when it is printed. Can anyone help. Thank You in advance. :cool: Gerald Grace
Novice Programmer
 
Using the MsysObjects table, and some variables and textboxes you can do this

Option Compare Database
Option Explicit
Dim strC As String, strM As String

Private Sub Report_Open(Cancel As Integer)
Dim db As DAO.database, rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset("MsysObjects", dbOpenDynaset)
With rst
.FindFirst "[Name] = 'ObjectName'"
strC = rst!DateCreate
strM = rst!dateUpdate
End With
End Sub

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
txtCreated = strC
txtModified = strM
End Sub

PaulF
 
Thank You Paul,
I have one more question.
How can i get the date to show up in a long format?
Gerald Grace
Wannabe Programmer :cool:
Please explain steps so I can learn.
Thank You Very Much.
 
use Format

Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
txtCreated = Format(strC, "Long Date") & " " & Format(strC, "Long Time")
txtModified = Format(strM, "Long Date") & " " & Format(strM, "Long Time")
End Sub

PaulF
 
Thanks Paul, the program works the way it should by grabbing information from the MSysObjects table, but now the table itself is giving the wrong information. Do you know why the MSysObjects table would not update to show the same date as what shows up when the properties for an object are displayed? Please help if you can. THANK YOU VERY MUCH. Gerald Grace
Wannabe Programmer :cool:
Please explain steps so I can learn.
Thank You Very Much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top