LAP
asked on
Getting the date modified value of a file.
Hi there
I don't know whether Access will provide me with the solution.
Here's the problem ....
I need to develop a program that will check the date mofidfied of a file on the server and compare it to the one that is on my PC. The file names are the same. If the one on the server is more updated than the one on my PC then I have to copy the one on the server to my PC.
I know I have to extract the date modified values of both files and do the comparison.
How would I do something like this or would Visual Basic remedy the problem?
Thanks.
Leigh
ASKER
Firstly, I don't have Visual FoxPro on my PC so I assume I can't make use of the code.
I've looked at the code at the site. It's seems quite complex and lengthy.
Doesn't MS Access have a simpler function!
Leigh
-------------------------- ---------- ---------- ---------- ---------- ---------- ----------
Leigh,
.
.
.
Dim MyStamp As Variant
' Assume TESTFILE was last modified on Feb. 12, 1993 at 4:35:47 PM.
' Assume English/U.S. locale settings.
MyStamp = FileDateTime("TESTFILE") ' Returns "2/12/93 4:35:47 PM".
You can call this function to fill in one variant with one call, and a different variant with a second call, (using different strings for the argument to the FileDateTime function), then compare the results.
Brian
Leigh,
.
.
.
Dim MyStamp As Variant
' Assume TESTFILE was last modified on Feb. 12, 1993 at 4:35:47 PM.
' Assume English/U.S. locale settings.
MyStamp = FileDateTime("TESTFILE") ' Returns "2/12/93 4:35:47 PM".
You can call this function to fill in one variant with one call, and a different variant with a second call, (using different strings for the argument to the FileDateTime function), then compare the results.
Brian
ASKER
Brian,
when I compile that code I get the following error msg "Compile error: Invalid outside procedure"
How do I specify the path where the file can be found?
Leigh
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Unable to make use of the example for Visual FoxPro.
....sorry :-(
ASKER
Brian,
I am increasing the points to 100. :-)
I'll then accept your comment as the answer.
Thanks .... Leigh
ASKER
Thanks!
You can do this in access code with the following API:
Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Declare Function GetFileTime Lib "kernel32" Alias "GetFileTime" (ByVal hFile As Long, lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime As FILETIME) As Long
...or to be simpler, check out
http://support.microsoft.com/support/kb/articles/Q188/9/77.asp
HTH
Simon