Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2011

    Unanswered: Can Access display file attributes?

    Hello, lemme explain my question...

    My company looks at hundreds of properties every year. Those we visit are photographed from multiple angles and stored in folders based on their account number. There are literally tens of thousands spread across many folders. I created a simple Access tool that is basically an image viewer, where I can put in an account number and then it's first image will display. Then I added simple controls (Next, Previous) to scroll through them. A handy tool but no big deal.

    My question is, can Access display a file attribute? Sometimes the only way we can tell when a property was looked at was to look to see when it's most recent picture was created. Can I load an image and then have Access display when that picture was created in a text box on the form? Any help would be appreciated. Thanks.

  2. #2
    Join Date
    Mar 2009
    Provided Answers: 15
    You can use the VBScript library, like this:
    Function GetFileInfo(FilePath As String)
    ' The project must have a reference to the VBScript library
    ' (Tools --> References -->  Microsoft Scripting Runtime).
        Dim fsoObject As Scripting.FileSystemObject
        Dim fsoFile As Scripting.File
        Set fsoObject = New Scripting.FileSystemObject
        Set fsoFile = fsoObject.GetFile(FilePath)
        With fsoFile
            Debug.Print .Attributes
            Debug.Print .DateCreated
            Debug.Print .DateLastAccessed
            Debug.Print .DateLastModified
            Debug.Print .Size
            Debug.Print .Type
        End With
        Set fsoFile = Nothing
        Set fsoObject = Nothing
    End Function
    Have a nice day!

  3. #3
    Join Date
    Apr 2011

    Thanks, looks good, but...

    Thank you. I am not a master at VB so another question. On my form, I input an account number. Then hit a search button I have set up and the first image in the set displays. From there I can hit Next and Previous to display any photos in that folder with the same base account number. As an example, an account number (RPC) of 11111 will have a file number of 0011111_01_01.jpg for the picture. With your code, where do I put it? I want it to display when the pictures load/changes so would it go in the After Update field for the new text box or should the code be in the On Click event of the Search, Next and Previous buttons leading to that new text box? Here is my code to load the initial picture... Thanks, hope I am not being confusing.

    pNum = 1
    dNum = 1
    Rec = Me.RPC.Text

    pth = "r:\" & "P0" & Left(Rec, 2) & "\"
    pFile = "00" & Rec & "_0" & dNum & "_0" & pNum & ".jpg"
    strFile = Dir(pth & pFile)

    If strFile <> "" Then

    Me.Ph.Picture = pth & pFile
    Me.PicNum.Text = pNum
    End If

    If IsNull(Me.PicNum) Then
    MsgBox "No pictures present for that RPC."
    End If

  4. #4
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    new question
    new thread please...
    dem's dare rules

    why, because it helps others in a similar position to you find answers proposed for your problem
    secondarily it may encourage other people to contribute answers, if they have already read the question and seen an answer which looks right then they may not revisit that question again
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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