Stable date stamps

John Sh

Member
Local time
Today, 17:42
Joined
Feb 8, 2021
Messages
503
The date stamps on an accde file change to reflect the last accessed date whether any changes have been made, or not, rendering these dates useless for detecting newer versions of the software.
There is, however, a stable date in he "Database properties" on the Access Info page.
Is it possible to read this information with vba?
Screenshot_24.jpg
 
How about using MSysObjects? Open a new query in an existing database and paste this SQL:

Code:
SELECT * FROM MSysObjects;

It has a DateUpdate field and also a Type field. I think Type=2 is the database itself, but it may be updated whenever it is accessed, unsure. But if you took the MAX(DateUpdate) of all types that are forms/queries/tables/reports/macros/vba you'd be able to tell what you want.
 
There is, however, a stable date in he "Database properties" on the Access Info page.
Which property would that be? The Modified one? Are you trying to determine if the data was changed?
 
This is the wrong approach. You are barking up the wrong tree. There is an old rule that if you know you will want a particular type of information to be in your database YOU (the designer/implementer) must assure that you provide it. When I was using version control for my biggest Navy DB, my FE and BE had version tables that included a date and a version number and the location (FE/BE). When I wanted to change a version number, I edited it into a table. As the FE launched, one of the first things it did in the File_Open routine of my opening form was to check the DB version as defined by a Public Constant in a general FE module against a DB version table that was stored in the BE. That table was also my change-history log that listed the changes I made and the version in which those changes first appeared.

If you want something done correctly, do it yourself. Keep a version as a (small or large) part of the file. Don't trust Access to do ANYTHING for you because Access is NOT open-sourced. You don't know WHAT it will do.

It should also be possible for you to create an arbitrary property of the database file that you can read using the File System Object to check for file "extended" properties.



And here is how you SET the properties. Note that Isladogs includes disclaimers because you have to download something to do this the way he does it.


You can create and assert a new value for a file's extended property using this:


Somewhere in here is a solution to your problem. But recognize that Access itself doesn't NEED a solution to your problem, so it doesn't have one. That's not me being snarky - it is a statement that Access is designed for you to "roll your own" solutions. It is a bare-bones utility despite its extreme power.
 
Code:
Dim CurrentFile As String
CurrentFile = CurrentProject.FullName
MsgBox FileDateTime(CurrentFile)
 

Users who are viewing this thread

Back
Top Bottom