How to get the file created date in VBA?

G

Guest

MS Access 2K, Windows XP
====================
Hi,

I've been trying to get the file create date stamp using code on a form.
I've tried using FileDateTime function, but it returns the modified date. The
help-file says:

"This example uses the FileDateTime function to determine the date and time
a file was created or last modified. "

I'm not sure what they mean by "created or last modified". Does that mean
whichever is later? And, how can I get the file created date?

If the only way is using FileSystemObject, will appreciate the code.

Thanks.

-Amit
 
G

Guest

Try this
FileDateTime(pathname)

Returns a Variant (Date) that indicates the date and time when a file was
created or last modified.
 
G

Guest

Ofer said:
Try this
FileDateTime(pathname)

Returns a Variant (Date) that indicates the date and time when a file was
created or last modified.

I did try FileDateTime() and mentioned it in my post. The problem is that if
the modified date is greater than the created date, it returns the modified
date.

I would like to get the created date. Is there a function that returns the
created date?

Thanks.

-Amit
 
J

John Nurick

Something like this:

Dim oFSO As Object
Dim oF As Object

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oF = oFSO.GetFile("D:\My folder\File.TXT")
Debug.Print F.DateCreated
Debug.Print F.DateLastModified

Set oF = Nothing
Set oFSO = Nothing
 
G

Guest

IT seems that there is a DateCreated property in a File object. You get it as:

Look for DateCreated Property in MS Access Help.
 

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