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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you programmatically change LastAccessed date

Status
Not open for further replies.

SBendBuckeye

Programmer
May 22, 2002
2,166
US
Hello All,

I'm working on a project to upgrade Access97 databases. To quantify the project, I am testing by setting a reference to a given database and then collecting information like number of Add-Ins, number of COM Add-Ins, etc. However, this resets the LastAccessed date which is also important.

Is there a way to programattically change the LastAccessed date back to its original value? Thanks in advance!

Have a great day!

j2consulting@yahoo.com
 
The only solution that I can think of would be to copy the file first. Then gather your data from the copy and the DateLastAccessed will be unchanged on the original.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
You can set the Last Accessed time using the SetFileTime API function. However, this is not trivial, because the API function requires a handle to a file (HFILE), so you'll have to open the file with an API call before you can get or change the time.

If you decide to go ahead with this, you'll need to define VBA versions of the Win32 FILETIME structure, and declare the API functions CreateFile, GetFileTime, SetFileTime, and CloseHandle.

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top