Question TXT File Attributes

AccessNewBoy

Registered User.
Local time
Today, 07:53
Joined
Mar 11, 2009
Messages
19
Hello,
I wonder if anyone can help me.

Is there a way for access to pull and show all the file attributes associated with a TXT file located in a folder or one that has been imported into the databae its self?

For example:
When it was created?
When it last was modified?
Size
etc etc

Either way thanks for taking the time to look
 
Here's code you can use.
This shows how to create a FileSystemObject, from which you can get a File (f As Object) which exposes the following properties.
Code:
Function GetFileData(filespec As String) As String
   Dim fso As Object
   Dim f As Object
   Dim tmp As String
   
[COLOR="Green"]   'create FileSystemObject[/COLOR]
   Set fso = CreateObject("Scripting.FileSystemObject")
[COLOR="Green"]   'check file exists[/COLOR]
   If fso.FileExists(filespec) Then
[COLOR="Green"]      'get a reference to the file[/COLOR]
      Set f = fso.GetFile(filespec)
[COLOR="Green"]      'list properties[/COLOR]
      tmp = _
         "   Created: " & f.DateCreated & vbCrLf & _
         "  Accessed: " & f.DateLastAccessed & vbCrLf & _
         "  Modified: " & f.DateLastModified & vbCrLf & _
         "     Drive: " & f.Drive & vbCrLf & _
         "      Name: " & f.Name & vbCrLf & _
         "    Parent: " & f.ParentFolder & vbCrLf & _
         "      Path: " & f.path & vbCrLf & _
         "Short Name: " & f.ShortName & vbCrLf & _
         "Short Path: " & f.ShortPath & vbCrLf & _
         "      Size: " & f.Size & "kb" & vbCrLf & _
         "      Type: " & f.Type
      MsgBox tmp, vbInformation, "Scripting.File Properties"
   Else
      tmp = "File Not Found: " & filespec
      MsgBox tmp, vbInformation, "File Not Found"
   End If
   GetFileData = tmp
End Function
 
LAGBOLT,
Thank you for taking the time to reply to my question, i have looked at your code/module and will be looking at ways to use it over the weekend while i am off.
I am very new to Access and am starting to think i am running before crawling with this problem. as most of the users would now exactly what to do with this code and how to use it or call it to look at the txt file.

Thanks.
 

Users who are viewing this thread

Back
Top Bottom