Results 1 to 4 of 4

Thread: Reading file properties from Access

  1. #1
    Join Date
    Jan 2003
    Location
    NH, USA
    Posts
    3

    Question Reading file properties from Access

    I am trying to figure out how to read the properties of any file from within Access. I can supply a full file spec and want to specifically read the DateLastModified (that you see when you view the properties of a file) for the file in question. I've looked at the filesearch object but can't get that to work. I figure I'll need to use API calls to do this but don't know which call to use or how to implement it. This is for an Access DB that catalogs various files in our company, I'm trying to write a routine that will allow a mass update of the cataloged files as to when they were last accessed with the single click of a button. Can someone point me in the right direction?

  2. #2
    Join Date
    Jan 2003
    Location
    FL
    Posts
    13

    Re: Reading file properties from Access

    Originally posted by Rich Zore I am trying to figure out how to read the properties of any file from within Access. ... I figure I'll need to use API calls to do this but don't know which call to use or how to implement it.
    You could use the WinAPI but it tain't necessary. Add a reference to the Microsoft Scripting Runtime to your project, then you can use a modification of this sub:
    Code:
    
    Sub dlm ( )
        Dim f As File
        Dim fso As New FileSystemObject
        Set f = fso.GetFile("C:\temp\<FileName>")
        MsgBox CStr(f.DateLastModified)
    End Sub
    
    Obviously, this is a real basic illustration of the FSO. There are many features available to you when you add the scripting runtime, and access to files and directories is simply one.

    Cheers,
    Gary

  3. #3
    Join Date
    Jan 2003
    Location
    New Zealand
    Posts
    2
    You can also use the FileDateTime Function

    Dim dtModified
    dtModified = FileDateTime("C:\temp\<FileName>")


    Cheers
    Barrie

  4. #4
    Join Date
    Jan 2003
    Location
    NH, USA
    Posts
    3

    Smile Solution

    Thanks guys, two good replies. One for VB and the other in Access. Worked like a charm and I'm grateful.

    Have a great day.

    Rich

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •