Properties

Spica

Registered User.
Local time
Today, 08:37
Joined
Aug 3, 2004
Messages
13
I the Microsoft Access window you can set database properties in File->Database properties->Advanced tab (I have a swedish version so I'm not sure which the english names are).

How do you fetch them from VB-code?
I've tried
Code:
CurrentDb().Properties("LatestVersion")
but it doesn't work.

Any ideas?
 
Code:
Dim prp As Property
For Each prp In CurrentDb.Properties
    Debug.Print prp.Name
Next
Set prp = Nothing
 
Hi,

What property are you looking for?
When you look for (for example) the 'date last modified', then use this code:
Code:
Public Sub LastFileUpdate()
  Dim fso As FileSystemObject
  Dim dbFile As File
  
  Set fso = New FileSystemObject
  Set dbFile = fso.GetFile(CurrentProject.FullName)
  MsgBox dbFile.DateLastModified
  Set dbFile = Nothing
  Set fso = Nothing
End Sub
Be sure that you've a reference to the 'Microsoft Scripting Runtime Library'
 
I have working code now

Thanks everyone. I have code that works now.

I used this one:

Code:
Public Function GetUpdated() As Boolean

    Dim dbs As Database
    Dim cnt As Container
    Dim doc As Document
    Dim prp As DAO.Property

    Set dbs = CurrentDb
    Set cnt = dbs.Containers!Databases
    Set doc = cnt.Documents!UserDefined
    GetUpdated = doc.Properties("Updated")
    dbs.Close
    
    'Set all to nothing
    Set doc = Nothing
    Set cnt = Nothing
    Set dbs = Nothing
    
End Function
 

Users who are viewing this thread

Back
Top Bottom