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

DateModifiedLast

Status
Not open for further replies.

gj0519

MIS
May 8, 2003
69
US
I have ~ 300 records where I have the UNC path to files that relate to my records. What I am trying is to follow the path and retrieve and insert the datemodifiedlast into the same table as my records. Not sure on where to start. I know how to write the code to select my field, just unsure on getting it to find and insert the date into my table. Using Acess 2003
Thanks,

GJ
 
Use the FileSystemObject.

Code:
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(.FoundFiles(lngFileIndex))
dteDateCreated = f.DateCreated
dteDateLastAccessed = f.DateLastAccessed
dteDateLastModified = f.DateLastModified

It is likely that you will have to modify the format of the dates before you insert them in your table.
 
In a standard code module create the following function.
Code:
Public Function getDateLastModified(varPathName) As Date
Dim objFSO As Object, objFile As Object
If Trim(varPathName & "") = "" Then Exit Function
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(varPathName) Then
  Set objFile = objFSO.GetFile(varPathName)
  getDateLastModified = objFile.DateLastModified
  Set objFile = Nothing
End If
Set objFSO = Nothing
End Function
And now the update query (SQL code)
Code:
UPDATE yourTable SET datemodifiedlast = getDateLastModified([your UNC field])

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top