File Modification Date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm importing a bunch of text files. I would like to capture the date the
text file was actually created (modification date) in the import. Can I do
that?
 
Kirk

I'm not clear on what you want. The date the text file was created (before
importing)? The date the text file was imported?

Since text files are rarely well-normalized, and since Access has
relationally-oriented features and functions, you (and Access) are probably
better off taking the raw import data and 'parsing' it into more permanent
(and better-normalized) tables ... so do you want the date you 'parsed' the
input?!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Kirk

You might need to do a bit of on-line searching, and searching in Access
HELP. I seem to recall that there IS a way to get attributes of files
(e.g., creationdate), but I don't recall HOW...

Perhaps one of the other newsgroup readers recalls the 'how'...

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Hi Jeff and Kirk,

One way is to use the FileSystemObject object. Air code:

Dim FSO As Object, TheFile As Object

Set FSO = CreateObject("Scripting.FileSystemObject")
Set TheFile = FSO.GetFile(TheFilespec)

DateLastModified = TheFile.DateLastModified

Set TheFile = Nothing
Set FSO = Nothing

With luck this will find the documentation:
http://msdn2.microsoft.com/en-us/library/ea5ht6ax.aspx
 
Why bother with FSO? The VBA FileDateTime function gives the last modified
date:

DateLastModified = FileDateTime(TheFilespec)

(I'd agree with FSO if you needed file create date, although I personally
prefer using APIs)
 
Back
Top