PC Review


Reply
Thread Tools Rate Thread

access database properties dialog

 
 
=?Utf-8?B?Um9iZXJ0?=
Guest
Posts: n/a
 
      24th Feb 2005
How can I get the information displayed in the database properties dialog
contents using VBA code?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?QW5kcsOpRw==?=
Guest
Posts: n/a
 
      24th Feb 2005
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

"Robert" wrote:

> How can I get the information displayed in the database properties dialog
> contents using VBA code?
>

 
Reply With Quote
 
=?Utf-8?B?Um9iZXJ0?=
Guest
Posts: n/a
 
      24th Feb 2005
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.

"AndréG" wrote:

> 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
>
> "Robert" wrote:
>
> > How can I get the information displayed in the database properties dialog
> > contents using VBA code?
> >

 
Reply With Quote
 
=?Utf-8?B?QW5kcsOpRw==?=
Guest
Posts: n/a
 
      25th Feb 2005
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



"Robert" wrote:

> 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.
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't access properties dialog box in hard drive =?Utf-8?B?QW5neQ==?= Windows XP Hardware 1 3rd May 2005 03:20 AM
access database properties dialog =?Utf-8?B?Um9iZXJ0?= Microsoft Access VBA Modules 0 21st Feb 2005 03:59 PM
access database properties dialog =?Utf-8?B?Um9iZXJ0?= Microsoft Access VBA Modules 3 17th Feb 2005 07:51 PM
Database Properties access Jim Hester Microsoft Access Macros 0 4th Nov 2004 05:01 PM
Cannot access folder properties dialog =?iso-8859-1?Q?J.F._H=E9bert?= Windows XP General 1 28th Sep 2004 05:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:18 PM.