List Custom Database Properties

Lister

Z Shift
Local time
Tomorrow, 06:04
Joined
Aug 24, 2003
Messages
305
Hi All

I have been given a db that was converted up to Acc2003 and then converted back down to Acc2K, because of this you can't view the Database Properties information in the File > Database Properties menu.
An Error Pops "[Database Name] is unable to load the database properties".

The issue is that the version and last date updated information for each front-end copy of the db is stored in the properties menu. So we can check that the users have the most up to date copy.

I have hunted down plenty of code which will let me update the properties from VB.

Code:
Sub SetCustomProp(prpName As Variant, prpValue)

'The following procedure accepts three arguments: prpName, and
      'prpValue.
      '
      'prpName: a String value representing the name of the property
      '         you want to create.
      '
      'prpValue: a Variant value representing the value of the property
      '          you want to set.
      '
   
      Dim db As dao.Database
      Dim doc As dao.Document
      Dim prp As Property

      Set db = CurrentDb
      Set doc = db.Containers!Databases.Documents!UserDefined
      Set prp = doc.Properties(prpName)
      prp.Value = prpValue

The issue is it doesn't work :(, I would assume that the value for prpName would be the name of the custom property that I would like to update.

If I use the code in the current application to call the value of a custom property, it looks like this... (I know from other code the custom propertie is "FrontEndVersion")
Code:
Function ap_GetDatabaseProp(dbDatabase As Database, strPropertyName As String) As Variant
  
   ap_GetDatabaseProp = dbDatabase.Containers!Databases _
         .Documents("UserDefined").Properties(strPropertyName).Value
         'Debug.Print ap_GetDatabaseProp
   
End Function

If I pass ap_GetDatabaseProp(Currentdb(),"FrontEndVersion") I get "2.5 - Beta".
Good

But if I pass SetCustomProp("FrontEndVersion", "2.6") I get a message box "Error Number: 13 - Type mismatch"

I would have assumed that "FrontEndVersion" was the name of the Property, but I must be going wrong somewhere.
I have had no luck finding some code that could list the custom properties, name and value.

Would anyone have some code or a solution to fixing the missing property menu?

Thanks
 
Last edited:
No, tried that, and as the return value from "FrontEndVersion" is "2.5 - Beta" I think I'm safe to assume it's a string value.

Thanks
 

Users who are viewing this thread

Back
Top Bottom