Accessing "Modified" property 
Author Message
 Accessing "Modified" property

Can anybody clue me in on how to retrieve the date properties
(Modified, Created, etc.) on the database properties screen?

Using currentdb.Properties(x) will get some properties, but not all.
Can anyone help?

--
Mike Barrett
"If you give a person a fish, they'll fish for a day.
But if you train a person to fish, they'll fish for a lifetime."
-- VP Dan Quayle (reported in NY Times, 10/14/92)

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Sun, 04 May 2003 03:00:00 GMT  
 Accessing "Modified" property

At the debug window:
?currentdb.Containers("Databases").Documents("SummaryInfo").Properties("DateCreated")
3/24/00 8:37:40 PM

the other property name is "LastUpdated"

HTH
--
Mark
( E-Mail Address Note: Texas is the lonestar not onestar)
--

Quote:

> Can anybody clue me in on how to retrieve the date properties
> (Modified, Created, etc.) on the database properties screen?

> Using currentdb.Properties(x) will get some properties, but not all.
> Can anyone help?

> --
> Mike Barrett
> "If you give a person a fish, they'll fish for a day.
> But if you train a person to fish, they'll fish for a lifetime."
> -- VP Dan Quayle (reported in NY Times, 10/14/92)

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Sun, 04 May 2003 03:00:00 GMT  
 Accessing "Modified" property
Thanks.

I used "LastUpdated". That gives me a date, but it doesn't coincide
with the "Modified" date shown on the General tab of the Database
Properties window.

Is there any way to just look at the File through the WIndows API and
pull in the date it was last modified?

--
Mike Barrett

"If you give a person a fish, they'll fish for a day.
But if you train a person to fish, they'll fish for a lifetime."
-- VP Dan Quayle (reported in NY Times, 10/14/92)

Quote:
> At the debug window:
> ?currentdb.Containers("Databases").Documents("SummaryInfo").Properties
("DateCreated")
> 3/24/00 8:37:40 PM

> the other property name is "LastUpdated"

> HTH
> --
> Mark
> ( E-Mail Address Note: Texas is the lonestar not onestar)
> --

> > Can anybody clue me in on how to retrieve the date properties
> > (Modified, Created, etc.) on the database properties screen?

> > Using currentdb.Properties(x) will get some properties, but not all.
> > Can anyone help?

> > --
> > Mike Barrett
> > "If you give a person a fish, they'll fish for a day.
> > But if you train a person to fish, they'll fish for a lifetime."
> > -- VP Dan Quayle (reported in NY Times, 10/14/92)

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Mon, 05 May 2003 03:00:00 GMT  
 Accessing "Modified" property
You could paste the code following my signature into a module and use
function fGetFileInfo.  I haven't thoroughly tested it, but it seems to
work.  Your usage would be along the lines of

    Dim dtCreated As Date, dtModified As Date
    dtCreated = fGetFileInfo(conFileInfo_TimeCreated, CurrentDb.Name)
    dtModified = fGetFileInfo(conFileInfo_TimeWritten)

Make sure no line wraps have been introduced in the code by newsreaders.

I'm no expert on the Windows API;  I sort of cobbled this together by
looking at routines on the Access Web (http://www.mvps.org/access).  There
may be a better way to do it, but it seems to work.
--

Dirk Goldgar
(remove NOSPAM from reply address)

'---- start of code ----
Private Const MAX_PATH& = 260
Private Const INVALID_HANDLE_VALUE = -1

Type FILETIME
    dwLowDateTime As Long
    dwHighDateTime As Long
End Type

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

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 Declare Function apiFindFirstFile Lib "kernel32" _
    Alias "FindFirstFileA" _
    (ByVal lpFileName As String, _
    lpFindFileData As WIN32_FIND_DATA) _
    As Long

Private Declare Function apiFindClose Lib "kernel32" _
    Alias "FindClose" _
    (ByVal hFindFile As Long) _
    As Long

Private Declare Function apiFileTimeToSystemTime Lib "kernel32" _
    Alias "FileTimeToSystemTime" _
    (lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long

Private Declare Function apiFileTimeToLocalFileTime Lib "kernel32" _
    Alias "FileTimeToLocalFileTime" _
    (lpFileTime As FILETIME, lpLocalFileTime As FILETIME) As Long

Public Const conFileInfo_Attributes = 0
Public Const conFileInfo_TimeCreated = 1
Public Const conFileInfo_TimeWritten = 2
Public Const conFileInfo_TimeAccessed = 3
Public Const conFileInfo_Size = 4
Public Const conFileInfo_Name = 5
Public Const conFileInfo_AlternateName = 6

Function fGetFileInfo(InfoType As Integer, Optional FileName As String) _
    As Variant

'Returns system information about the specified file, or the most recently
'specified file if no file is specified.

'The InfoType argument determines
'which datum is returned, as follows:
'   0 = Attributes (type Variant(Long))
'   1 = Creation date/time (type Variant(Date))
'   2 = Last Write date/time (type Variant(Date))
'   3 = Last Access date/time (type Variant(Date))
'   4 = Size in bytes (type Variant(Long))
'   5 = Name (type Variant(String))
'   6 = Alternate (DOS) Name (type Variant(String))
'Public constants for InfoType, with names beginning "conFileInfo_",
'have been defined in the Declarations section of this module.

'The FileName argument specifies the path to the file.  If wild-card
characters are used, data is returned for the first matching file.  If the
'specified file isn't found, Null is returned.

'Usage Examples:
'   ?fGetFileInfo(conFileInfo_TimeCreated, currentdb.Name)
'   7/21/00 12:10:03 PM
'   ?fGetFileInfo(conFileInfo_TimeWritten)
'   11/16/00 2:17:30 PM
'
    Static lpFindFileData As WIN32_FIND_DATA
    Dim lpSystemTime As SYSTEMTIME
    Dim lpLocalFileTime As FILETIME
    Dim lngRet As Long
    Dim lngX As Long

    If Len(FileName) = 0 Then
        If Left(lpFindFileData.cFileName, 1) = vbNullChar Then
            Err.Raise 5
        End If
    Else
        lngRet = apiFindFirstFile(FileName, lpFindFileData)
        lngX = apiFindClose(lngRet)
        If lngRet = INVALID_HANDLE_VALUE Then
            Mid$(lpFindFileData.cFileName, 1, 1) = vbNullChar
            fGetFileInfo = Null
            Exit Function
        End If
    End If

    Select Case InfoType
        Case conFileInfo_Attributes
            fGetFileInfo = lpFindFileData.dwFileAttributes
        Case conFileInfo_TimeCreated
            lngX = apiFileTimeToLocalFileTime( _
                            lpFindFileData.ftCreationTime, _
                            lpLocalFileTime)
            lngX = apiFileTimeToSystemTime(lpLocalFileTime, lpSystemTime)
            With lpSystemTime
                fGetFileInfo = DateSerial(.wYear, .wMonth, .wDay) _
                             + TimeSerial(.wHour, .wMinute, .wSecond)
            End With
        Case conFileInfo_TimeWritten
            lngX = apiFileTimeToLocalFileTime( _
                            lpFindFileData.ftLastWriteTime, _
                            lpLocalFileTime)
            lngX = apiFileTimeToSystemTime(lpLocalFileTime, lpSystemTime)
            With lpSystemTime
                fGetFileInfo = DateSerial(.wYear, .wMonth, .wDay) _
                             + TimeSerial(.wHour, .wMinute, .wSecond)
            End With
        Case conFileInfo_TimeAccessed
            lngX = apiFileTimeToLocalFileTime( _
                            lpFindFileData.ftLastAccessTime, _
                            lpLocalFileTime)
            lngX = apiFileTimeToSystemTime(lpLocalFileTime, lpSystemTime)
            With lpSystemTime
                fGetFileInfo = DateSerial(.wYear, .wMonth, .wDay) _
                             + TimeSerial(.wHour, .wMinute, .wSecond)
            End With
        Case conFileInfo_Size
            '*** this is incomplete, ignoring nFileSizeHigh !!
            fGetFileInfo = lpFindFileData.nFileSizeLow
        Case conFileInfo_Name
            fGetFileInfo = Left$(lpFindFileData.cFileName, _
                    InStr(lpFindFileData.cFileName, vbNullChar) - 1)
        Case conFileInfo_AlternateName
            fGetFileInfo = Left$(lpFindFileData.cAlternate, _
                    InStr(lpFindFileData.cAlternate, vbNullChar) - 1)
        Case Else
            Err.Raise 5
    End Select

End Function
'---- end of code ----


Quote:
> Thanks.

> I used "LastUpdated". That gives me a date, but it doesn't coincide
> with the "Modified" date shown on the General tab of the Database
> Properties window.

> Is there any way to just look at the File through the WIndows API and
> pull in the date it was last modified?

> --
> Mike Barrett

> "If you give a person a fish, they'll fish for a day.
> But if you train a person to fish, they'll fish for a lifetime."
> -- VP Dan Quayle (reported in NY Times, 10/14/92)

> > At the debug window:
> > ?currentdb.Containers("Databases").Documents("SummaryInfo").Properties
> ("DateCreated")
> > 3/24/00 8:37:40 PM

> > the other property name is "LastUpdated"

> > HTH
> > --
> > Mark
> > ( E-Mail Address Note: Texas is the lonestar not onestar)
> > --

> > > Can anybody clue me in on how to retrieve the date properties
> > > (Modified, Created, etc.) on the database properties screen?

> > > Using currentdb.Properties(x) will get some properties, but not all.
> > > Can anyone help?

> > > --
> > > Mike Barrett
> > > "If you give a person a fish, they'll fish for a day.
> > > But if you train a person to fish, they'll fish for a lifetime."
> > > -- VP Dan Quayle (reported in NY Times, 10/14/92)

> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Mon, 05 May 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Programmatically modifying field "description" property

2. Setting the "AllowZeroLength"-Property in Access

3. Properties and "sub-Properties"

4. How to Modify "sent From" field

5. "modified outside the source editor"

6. modifying "run=" line in win.ini

7. *"*-.,._,.-*"* I"LL TRADE VISUAL C++ FOR VBASIC *"*-.,_,.-*"*

8. GetObject("","InternetExplorer.Application") fails in Excel VBA

9. SysCmd 603, "path","path"

10. Disabling "BACK"/"FORWARD" buttons

11. Loop print "VARIABLE", "VARIABLE"

12. DLL or something like "#"#ยค#"!"#

 

 
Powered by phpBB® Forum Software