[AccessD] Date Modified

Rocky Smolin - Beach Access Software bchacc at san.rr.com
Fri Aug 13 00:42:30 CDT 2004


Marty:

Thanks.  Very useful.  I back up my work compulsively and now I've got three
places to copy it - secondary machine, flash drive, and laptop.  So I
whipped up a little app to do this automatically.  But I find that the
backup which give the dates modified of both the old and the new to be very
useful.  Stops me from backing up the wrong way.  So I was trying to
simulate that.

Regards,

Rocky Smolin
Beach Access Software
http://www.e-z-mrp.com


----- Original Message ----- 
From: "MartyConnelly" <martyconnelly at shaw.ca>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Thursday, August 12, 2004 1:47 PM
Subject: Re: [AccessD] Date Modified


> If you need more detail, this gives you last write,creation and last
> access date
>
> Option Compare Database
> Option Explicit
>
>  Private Declare Function FindFirstFile Lib "kernel32" Alias _
>   "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As _
>   WIN32_FIND_DATA) As Long
> Private Declare Function FileTimeToLocalFileTime Lib "kernel32" _
>    (lpFileTime As FILETIME, lpLocalFileTime As FILETIME) As Long
> Private Declare Function FileTimeToSystemTime Lib "kernel32" _
>    (lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long
> 'get the file's datetime stamp
> Private Declare Function GetFileTime Lib "kernel32" _
>     (ByVal hFile As Long, lpCreationTime As FILETIME, _
>     lpLastAccessTime As FILETIME, _
>     lpLastWriteTime As FILETIME) As Long
>
>
>  Const MAX_PATH = 260
>  Private Type FILETIME
>     dwLowDateTime As Long
>     dwHighDateTime As Long
>  End Type
>  Private Type WIN32_FIND_DATA
>     dwFileAttributes As Long
>     ftCreationTime As FILETIME
>     ftLastAccessTime As FILETIME
>     ftLastWriteTime As FILETIME
>     nFileSizeHigh As Long
>     nFileSizeLow As Long
>     dwReserved0 As Long
>     dwReserved1 As Long
>     cFileName As String * MAX_PATH
>     cAlternate As String * 14
>  End Type
>  Private Type SYSTEMTIME
>   wYear As Integer
>   wMonth As Integer
>   wDayOfWeek As Integer
>   wDay As Integer
>   wHour As Integer
>   wMinute As Integer
>   wSecond As Integer
>   wMilliseconds As Integer
> End Type
> 'used to store timestamps from GetFileTime API call
> Public Type FileTimeStamps
>     ftCreate As Date
>     ftAccess As Date
>     ftModify As Date
> End Type
>
>
>
> Sub test()
>  Dim FileData As WIN32_FIND_DATA
>  Dim FT As FILETIME
>  Dim ST As SYSTEMTIME
>  Dim lretval As Long
>    FileData.cFileName = Space$(MAX_PATH)
>    lretval = FindFirstFile("C:\Access files\Snapscreenform.mdb", FileData)
>    Debug.Print FileData.cFileName
>
>    Debug.Print ConvertGetFileTime(FileData.ftCreationTime)
>     Debug.Print ConvertGetFileTime(FileData.ftLastAccessTime)
>      Debug.Print ConvertGetFileTime(FileData.ftLastWriteTime)
>      Debug.Print FileDateTime("C:\Access files\Snapscreenform.mdb")
>
>   Debug.Print FileData.ftCreationTime.dwHighDateTime & _
>     FileData.ftCreationTime.dwLowDateTime
> End Sub
> Private Function ConvertGetFileTime(FT As FILETIME) As Date
>     'convert the low and high times to dates
>     Dim lngWFD As Long
>     Dim ST As SYSTEMTIME
>     Dim LOCTime As FILETIME
>
>     'convert to your time, not GMT
>     FileTimeToLocalFileTime FT, LOCTime
>     FileTimeToSystemTime LOCTime, ST
>
>     ConvertGetFileTime = _
>         DateSerial(ST.wYear, ST.wMonth, ST.wDay) + _
>         TimeSerial(ST.wHour, ST.wMinute, ST.wSecond)
>
> End Function
>
> Arthur Fuller wrote:
>
> >That will work where the scripting runtime is installed, but IME almost
> >every company forbids its installation because it is so potentially
> >dangerous.
> >
> >-----Original Message-----
> >From: accessd-bounces at databaseadvisors.com
> >[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
> >paul.hartland at fsmail.net
> >Sent: Thursday, August 12, 2004 4:15 AM
> >To: Access Developers discussion and problem solving
> >Subject: Re: [AccessD] Date Modified
> >
> >
> >Rocky,
> >If you set a reference to Microsoft Scripting Runtime then add the
> >following code: Dim fsys As New FileSystemObject Dim dtProductsCSV As
> >Date Dim fProductsCSV As Object
> >
> >Set fProductsCSV = fsys.GetFile(FilePath & FileName) dtProductsCSV =
> >fProductsCSV.DateLastModified
> >
> >
> >
> >
> >
> >
> >Message date : Aug 12 2004, 01:53 AM
> >>From : "Rocky Smolin - Beach Access Software"
> >To : AccessD at databaseadvisors.com
> >Copy to :
> >Subject : [AccessD] Date Modified
> >Dear List:
> >
> >Is there a method to retrieve the Date Modified from a file?
> >
> >TIA
> >
> >Rocky Smolin
> >Beach Access Software
> >http://www.e-z-mrp.com
> >
> >--
> >_______________________________________________
> >AccessD mailing list
> >AccessD at databaseadvisors.com
> >http://databaseadvisors.com/mailman/listinfo/accessd
> >Website: http://www.databaseadvisors.com
> >
> >
> >
>
> -- 
> Marty Connelly
> Victoria, B.C.
> Canada
>
>
>
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com




More information about the AccessD mailing list