Display Database Modified Date on form

Z

Zoe

I would like to display the date that the database was last modified on a form.
I found a message in the newsgroup (I can't seem to find it again) that
suggested this code:

Dim fs As Object
Dim f As Object
Dim strModDate As String

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(CurrentProject.FullName)
strModDate = f.DateLastModified
Debug.Print strModDate
Set f = Nothing
Set fs = Nothing

However, I need a little more direction. Can someone please provide some
basic assistance? I'm assuming that the code is assigned to an event on the
label, but I'm not sure if this is correct or what event to use. Also, do I
modify the CurrentProject.FullName? If so, to what?

Thanks!
 
J

John W. Vinson

I would like to display the date that the database was last modified on a form.

I don't know any good way to do that without writing a WHOLE lot of code. The
Windows "modified" date gets changed whenever a database is opened, whether or
not you make any design changes to any of the objects or update any tables.

Do you want to track when the *structure* of the database was modified, or the
*values* in one or more tables changed?

John W. Vinson [MVP]
 
Z

Zoe

Thanks for the quick reply. The writing of a whole lot of code sounds very
dismal to me.

Here is my process. I have a database that is maintained in one location.
The data in the underlying tables is added, deleted or modified within this
location. The file is shared out to multiple locations on a nightly basis.
The users at those locations do not modify the data at all, they are reading
it from another application.

My thought was to use the modifed date as an indicator if we needed to
verify that the locations had the most current version (e.g. does the modifed
date in the lacation match the modified date in the main location). But if
the modifed date changes when the database is opened, it won't be correct.

I have considered storing a user generated version number when the database
is updated by the main location - unless you have any further thoughts. I
thank you for your time!
 
J

John W. Vinson

I have considered storing a user generated version number when the database
is updated by the main location - unless you have any further thoughts. I
thank you for your time!

That's almost surely your best bet. Just have a little one-record, one-field
table with a Date/Time field WhenModified. As part of the code that makes the
database available to the users, set it to Now().

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top