File Modification Date

K

Kirk P.

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?
 
J

Jeff Boyce

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
 
J

Jeff Boyce

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
 
J

John Nurick

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
 
D

Douglas J. Steele

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top