Re: Database Properties : Date Created vs DateCreated
- From: "Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
- Date: Sat, 6 Jan 2007 00:31:07 -0500
The database object has a Properties collection, maybe you will find what
you are searching there. Here is an exemple of code for setting and getting
properties into this collection:
Private Const cerrPropertyNotFound As Integer = 3270
Public Sub SetProperty(ByVal strPropName As String, _
ByVal varPropType As Integer, _
ByVal varPropValue As Variant)
Const cProcedureName As String = "SetProperty"
On Error GoTo Err_Handler
Dim db As DAO.Database
Dim prp As DAO.Property
Set db = DAODatabase()
Dim i
For i = 0 To db.Properties.Count - 1
If (db.Properties(i).name = strPropName) Then
db.Properties(strPropName).Value = varPropValue
GoTo Exit_Sub
End If
Next
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Set prp = Nothing
Exit_Sub:
On Error GoTo 0
' Set prp = Nothing
Set db = Nothing
Exit Sub
Err_Handler:
' Err_Handler: utilisée dans l'ancienne version.
Select Case err
Case cerrPropertyNotFound
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Set prp = Nothing
Case Else
' Call LogError(Err.Number, Err.Description, cModuleName &
cProcedureName)
End Select
Resume Exit_Sub
End Sub
Public Function GetProperty(ByVal strPropName As String, _
ByRef strPropValue As Variant) As Boolean
Const cProcedureName As String = "GetProperty"
On Error GoTo Err_Handler
Dim db As DAO.Database
Set db = DAODatabase()
Dim i
For i = 0 To db.Properties.Count - 1
If (db.Properties(i).name = strPropName) Then
strPropValue = db.Properties(strPropName)
GetPropertyMDB = True
GoTo Exit_Function
End If
Next
GetProperty = False
Exit_Function:
On Error GoTo 0
Set db = Nothing
Exit Function
Err_Handler:
GetProperty = False
Select Case err
Case cerrPropertyNotFound
Case Else
' Call LogError(Err.Number, Err.Description, cModuleName &
cProcedureName)
End Select
Resume Exit_Function
End Function
--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
"Tintin" <u30712@uwe> wrote in message news:6bd5cd38ee0c8@xxxxxx
Dear All,
I was trying to get my database propeties using VBA Code as follow :
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile("FileName")
zDateCreated = f.DateCreated
zDateModified = f.dateLastModified
MsgBox Created : & zDateCreated & " Modified : " &
zDateModified
It works fine, but the result of Msgbox makes me curious why zDateCreated
and
zDateModified is not the same when I check through File > Database
Properties
General ?
1. In the MsgBox shows (yy/mm/dd hh:nn:ss) :
Created : 06/12/07 10:21:44 Modified : 06/12/07 10:22:00
2. In File > Database Properties > General (yy/mm/dd
hh:nn:ss)
shows:
Created : 07/01/06 02:43:02 Modified : 07/01/05 22:48:16
Please someone tell me why? How can I get (through VBA Code) the same
Database Properties when I click File > Database Properties > General?
Thanks,
Tintin
.
- Follow-Ups:
- Re: Database Properties : Date Created vs DateCreated
- From: Tintin via AccessMonster.com
- Re: Database Properties : Date Created vs DateCreated
- References:
- Database Properties : Date Created vs DateCreated
- From: Tintin
- Database Properties : Date Created vs DateCreated
- Prev by Date: Re: Multi-Field Primary Key
- Next by Date: Re: Database Properties : Date Created vs DateCreated
- Previous by thread: Database Properties : Date Created vs DateCreated
- Next by thread: Re: Database Properties : Date Created vs DateCreated
- Index(es):
Relevant Pages
|