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

Get date and time of file

Status
Not open for further replies.

franksirvent

Programmer
Mar 8, 2002
358
GB
Hi
I am trying to get the date and time from a file in a directory within VBA.

I used to have something like this on a previous program but I cannot remember exactly...

txtversion = "Last Update " & timedate([Forms]![User Details]![txtserverdirectory] & "\global.mdb")

I believe the 'timedate' part is wrong but I just can´t remember. I tried to search on the ACCESS HELP but it says that the Help files are not there (I am not sure what´s wrong, because HELP sometimes works, sometimes don't)

Any ideas?

thanks
 
Try ...

txtversion = "Last Update " & FileDateTime([Forms]![User Details]![txtserverdirectory] & "\global.mdb")

Tiny

Perfection is Everything
If it worked first time we wont be here!
 
You should use the filesystemobject. Can click F1 on this and Access will giude you thru

The following is from the Help

Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = UCase(filespec) & vbCrLf
s = s & "Created: " & f.DateCreated & vbCrLf
s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
s = s & "Last Modified: " & f.DateLastModified
MsgBox s, 0, "File Access Info"


Best of luck
 
thanks for info!

both ways are quite helpful.
regarding the F1 (for HELP) like I said I constantly have problems with Access, the HELP simply doesn´t open for some obscure reason, this is why I couldn´t find an answer through Access Help.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top