locked
filescriptingobject reports wrong file creation date RRS feed

  • Question

  • Using Access 2003 on Windows 7 pro.

    I am writing an accounting report which summarizes time card data and the accountants want to see the date a file was downloaded from ADP.

    So I use filescriptingobject thusly in the report code: ( the filesystemobject is instantiated in the parent form fMain)

      Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
      Dim f As Variant
      Set f = Form_fMain.fs.GetFile("N:\Accounting\ADP\Data\ReportDownload_Lucy.csv")

      Me.txtDownloaded = f.DateCreated
      Set f = Nothing
      End Sub

    For some reason GetFile reports the date as 5/19/2015 when the actual file date is 11/23/2015.

    Could GetFile be reporting the date this file was first created, even though it has been replaced many times, overwritten with new copies from subsequent downloads?

    On a related note, can someone explain how to insert a print-screen into a post? When I click on the 'insert image' icon, the form which opens will not let me paste a print-screen, it wants me to drop an image into the form. How do I save a print-screen to drag and drop into the image form?

    Thanks in advance for any help  --Fred


    Monday, December 7, 2015 3:01 PM

Answers

  • Hi Fred,

    >> For some reason GetFile reports the date as 5/19/2015 when the actual file date is 11/23/2015

    Based on your code, I made a test with this, but I failed to reproduce your issue under Access 2013. I suggest you check the property of ReportDownload_Lucy.csv to see Created time. If they are not same, I suggest you test this code under later version like Access 2013. My test code as below:

    Sub ShowFileAccessInfo(filespec)
        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"
    End Sub

    >> Could GetFile be reporting the date this file was first created, even though it has been replaced many times, overwritten with new copies from subsequent downloads?

    No, DateCreated will return the date when you replaced.

    >> How do I save a print-screen to drag and drop into the image form?

    After you have a print-screen, you could open Paint application, then paste (Ctrl+V), and then save the file to a path. After saving, you could click ‘insert image’ icon to insert this image.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, December 8, 2015 2:16 AM