File or database update time

  • Thread starter Thread starter Thomas
  • Start date Start date
T

Thomas

When I print reports I'd like to have the footer have the time and date of
the last change to the database or the file, rather than Now().

Can't seem to find a way to put something like LastModifiedDate() in the
footer of a report.

Is there a way?

Thanks.

Thomas
 
What would you call the LastModifiedDate: the last time any data was
changed, or the last time data specific to the report was changed or the
last time the design of the report changed?

Access doesn't keep track of when data changes: you'd have to add that
functionality yourself. The normal way is to put a "LastUpdated" field in
your table, and to set its value in the BeforeUpdate event of your form.
Once you do that, then you need to put code in your report to look up that
value and report it.

For the last time the report itself changed, you can query the (undocumented
and normally hidden) MSysObjects table.
 
Hi Thomas,

Apparently you don't want to know when they printed the reports so much as
when the last item of data was changed. To do things like that I often
include a table of configuration and context items. To allow for wide
variations between applications I use an ItemName field and an ItemValue
field. I can then look in tblConfig for the named item and find or change
its value.

In the AfterUpdate event of every form you need code to put the value
returned by Now() into tblConfig in the value for the item Last Modified
Date and Time. In the event that you have other instances of changes to
data that occurs in other Subs or Functions you need to add that same code
there.

If someone has opened your application and browsed around without changing
data and then printed a report the footer of the report would display the
date and time that data was last modified.

HTH
 
Back
Top