[AccessD] Fascinating behavior of database properties collection

John Colby jwcolby at gmail.com
Sat May 15 19:09:50 CDT 2021


I wasn't trapping errors and Property(10) which is a connection object
(apparently) could not convert to a string to print out.  Thus the loop
errored, bubbled up to the next higher level and appeared to not exist
after that.

I put on error resume next before the problematic line and found it.

Property Count : 56
1 : Connect :
2 : Transactions : True
3 : Updatable : True
4 : CollatingOrder : 1033
5 : QueryTimeout : 60
6 : Version : 12.0
7 : RecordsAffected : 0
8 : ReplicaID :
9 : DesignMasterID :
11 : AccessVersion : 09.50
12 : Build : 606
13 : AppTitle : C2DbProperties2007
14 : StartUpShowDBWindow : True
15 : StartUpShowStatusBar : True
16 : AllowShortcutMenus : True
17 : AllowFullMenus : True
18 : AllowBuiltInToolbars : True
19 : AllowToolbarChanges : True
20 : AllowSpecialKeys : True
21 : HijriCalendar : False
22 : Auto Compact : 0
23 : Perform Name AutoCorrect : 0
24 : Log Name AutoCorrect Changes : 0
25 : Track Name AutoCorrect Info : 0
26 : Four-Digit Year Formatting : 0
27 : Show Values Limit : 1000
28 : Show Values in Indexed : 1
29 : Show Values in Non-Indexed : 1
30 : Show Values in Remote : 0
31 : Show Values in Snapshot : 1
32 : Show Values in Server : 0
33 : Row Limit : 10000
34 : AllowBreakIntoCode : True
35 : AllowBypassKey : True
36 : StartUpForm : frm_CopyFiles
37 : ProjVer : 119
38 : UseAppIconForFrmRpt : False
39 : Use Default Page Folder : 0
40 : Use Default Connection File : 0
41 : ANSI Query Mode : 0
42 : NavPane Closed : 0
43 : NavPane Width : 215
44 : NavPane Category : 0
45 : NavPane View By : 0
46 : NavPane Sort By : 1
47 : HasOfflineLists : 70
48 : UseMDIMode : 1
49 : ShowDocumentTabs : True
50 : AllowDatasheetSchema : True
51 : Picture Property Storage Format : 1
52 : Theme Resource Name : Office Theme
53 : Show Navigation Pane Search Bar : 0
54 : WebDesignMode : 0
55 : DesignWithData : True
56 : DesignWithData : True

? lproperties(10).Name
Connection



On Sat, May 15, 2021 at 7:28 PM Bill Benson <bensonforums at gmail.com> wrote:

> Many properties have no value until set.
>
> On Sat, May 15, 2021 at 7:12 PM John Colby <jwcolby at gmail.com> wrote:
>
> > This code:
> >
> > Notice the count property of the collection says it has 56 properties,
> but
> > it only prints names and values for 10 of the properties.  At least using
> > the "For each" iterator.
> >
> > However if I index in directly with an integer, for example
> > lProperties(40).name I get a value returned.
> >
> > Function mIterateProperties(lProperties As DAO.Properties)
> > Dim lPrp As DAO.Property
> > Dim intIndex As Integer
> >     Debug.Print "Property Count : " & lProperties.Count
> >     For Each lPrp In lProperties
> >         intIndex = intIndex + 1
> >         Debug.Print intIndex & " : " & lPrp.Name & " : " & lPrp.Value
> >     Next lPrp
> > End Function
> >
> > Gives this result:
> >
> > Property Count : 56
> > 1 : Name : C:\DavidEmbley\C2DbProperties\C2DbProperties2007.accdb
> > 2 : Connect :
> > 3 : Transactions : True
> > 4 : Updatable : True
> > 5 : CollatingOrder : 1033
> > 6 : QueryTimeout : 60
> > 7 : Version : 12.0
> > 8 : RecordsAffected : 0
> > 9 : ReplicaID :
> > 10 : DesignMasterID :
> >
> > Some of the values that can't be seen with the For Each iterator are:
> >
> >       opt_StartupShowStatusBar = dbs.Properties("StartupShowStatusBar")
> >       opt_StartupShowDBWindow = dbs.Properties("StartupShowDBWindow")
> >       opt_AllowBuiltinToolbars = dbs.Properties("AllowBuiltinToolbars")
> >       opt_AllowFullMenus = dbs.Properties("AllowFullMenus")
> >       opt_AllowBreakIntoCode = dbs.Properties("AllowBreakIntoCode")
> >       opt_AllowSpecialKeys = dbs.Properties("AllowSpecialKeys")
> >       opt_AllowBypassKey = dbs.Properties("AllowBypassKey")
> >       opt_AllowShortcutMenus = dbs.Properties("AllowShortcutMenus")
> >       opt_AllowToolbarChanges = dbs.Properties("AllowToolbarChanges")
> >
> > They return a boolean value.
> >
> > Mighty strange if you ask me.
> >
> > --
> > John W. Colby
> > Colby Consulting
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


-- 
John W. Colby
Colby Consulting


More information about the AccessD mailing list