Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2005

Tip: Looking for answers? Try searching our database.

access database properties dialog

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robert - 24 Feb 2005 16:40 GMT
How can I get the information displayed in the database properties dialog
contents using VBA code?
AndréG - 24 Feb 2005 17:29 GMT
Here is some code I use to return the value of a "user defined database
property" I named "Appversion"

PS: sorry for not applying standard naming conventions I can't get used to
it and too old to adapt.

Const VersionPropertyName = "AppVersion"
Const PropertyNotFound = 3270

Function GetAppVersion(dbs As Database) As Integer
2240    Dim Cnt As Container, Doc As Document, prp As Property, AppVersion
As Single
2250    On Local Error GoTo GetSummary_Err
2255    Set Cnt = dbs.Containers!Databases
2260    Set Doc = Cnt.Documents!Userdefined
2265    Doc.Properties.Refresh
2270    AppVersion = Doc.Properties(VersionPropertyName)
GetSummary_Bye:
2280    Set Cnt = Nothing
2285    Set Doc = Nothing
2290    GetAppVersion = Round(AppVersion, 2)
2300    Exit Function
GetSummary_Err:
2305    AppVersion = 0
2310    If Err = PropertyNotFound Then
2315        Set prp = Doc.CreateProperty(VersionPropertyName, dbDouble, 0)
2320        Doc.Properties.Append prp
2325        Set prp = Nothing
2330        Resume
2335    Else
2340        If Error_message() Then Resume 0
2345        Resume GetSummary_Bye
2350    End If
End Function

Function SetAppVersion(dbs As Database, AppVersion As Integer) As Boolean
2355    Dim Cnt As Container, Doc As Document, prp As Property
2360    On Local Error GoTo SetCustom_Err
2370    Set Cnt = dbs.Containers!Databases
2375    Set Doc = Cnt.Documents!Userdefined
2380    Doc.Properties.Refresh
2385    Set prp = Doc.Properties(VersionPropertyName)
2390    prp = AppVersion
2395    SetAppVersion = True
SetCustom_Bye:
2400    Set Cnt = Nothing: Set Doc = Nothing: Set prp = Nothing
2410    Exit Function
SetCustom_Err:
2415    If Err = PropertyNotFound Then
2420        Set prp = Doc.CreateProperty(VersionPropertyName, dbDouble,
AppVersion)
2425        Doc.Properties.Append prp
2430        Resume Next
2435    Else
2440        If Error_message() Then Resume 0
2445        SetAppVersion = False
2450        Resume SetCustom_Bye
2455    End If
End Function

rgds
AndreG

> How can I get the information displayed in the database properties dialog
> contents using VBA code?
Robert - 24 Feb 2005 17:35 GMT
This is fine but it does not get me the data in the contents tab of the
database properties dialog box.  The document properties contain some of the
information but not all of it.

> Here is some code I use to return the value of a "user defined database
> property" I named "Appversion"
[quoted text clipped - 61 lines]
> > How can I get the information displayed in the database properties dialog
> > contents using VBA code?
AndréG - 25 Feb 2005 08:54 GMT
 Dim db As Database
  Dim prpLoop As Property

  Set db= OpenDatabase(".......")
 
     For Each prpLoop In db.Properties
           If prpLoop <> "" Then Debug.Print "  " & prpLoop.Name & " = " &
prpLoop
     Next prpLoop
     db.Close

> This is fine but it does not get me the data in the contents tab of the
> database properties dialog box.  The document properties contain some of the
> information but not all of it.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.