Re: Database Properties : Date Created vs DateCreated



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



.



Relevant Pages

  • RE: 2007 User Level Security
    ... One can never totally protect a database. ... Dim prp As Property ... varPropValue As Variant) As Integer ... Dim dbs As Object, prp As Variant ...
    (microsoft.public.access.modulesdaovba)
  • Re: Database Properties
    ... to read it from an external database as well. ... Dim strName As String, strValue As String ... Set prp = doc.CreateProperty(strPropName, intPropType, ...
    (microsoft.public.access.developers.toolkitode)
  • Re: Sources for query parameters
    ... You can create new properties for the database, ... Set prp = CurrentDb.CreateProperty(PropertyTitle, dbText, ... the variable becomes part of the Word document and its value ... GetRootFolder = CurrentDb.Name ...
    (microsoft.public.access.queries)
  • Re: Security for the front end of db
    ... adding this code to my Access database? ... varPropValue As Variant) As Integer ... Dim db As DAO.Database, prp As DAO.Property ... SetProperties = False ...
    (microsoft.public.access.security)
  • Re: Display Current State of AllowBypassKey
    ... see and modify that and all the other start up options in a database. ... has AllowBypassKey turned off, I used to have to have to open the database, ... Dim prp As DAO.Property ... Set prp = db.CreateProperty(stPropName, _ ...
    (microsoft.public.access.modulesdaovba)