it appears clear to me that VBA
doesn't have an immediate reference...
Depending on how you want to look at it, VBA does, or doesn't, haven't an
"immediate reference" to these properties. VBA is not "part" of the
database. Access and VBA are two different things... VBA is merely a tool
that we use to access various parts of the Access application. VBA does not
"have" these properties, but instead provides us a way to interact with
Access, which *may* have these properties.
So, VBA does not have an "immediate reference". In fact, it has no
reference whatsoever, as these properties are not part of VBA.
VBA does however, have a method to reference these properties:
CurrentDb.Properties("propname") = Value
The point that you are missing is that even though VBA gives us an interface
to work with these database properties, that does not mean that the
properties exist in Access. Some do, by default, other's don't, by default,
and need to be created (such as AllowBypassKey). You can create your own
custom properties and refer to them elsewhere.
Some properties that you create are already "defined" somehow in Access,
even if they do not yet exist. AllowBypassKey is a good example. It
doesn't, by default, exist, but when created, Access will recognize it and
handle accordingly. Other properties, custom ones, for instance say
"ThisTestProp", you can create, and Access itself will do absolutely nothing
with it. But you, as the developer, and use it elsewhere even though it has
not internal meaning to Access.
This may seem to be getting a bit off base with your original question, but
really, it's not. From what I gather (though you haven't been very clear on
it), you are using v2007, and yet referencing built-in properties of v2000
and v2003. IMHO, this is not a good idea.
Working with properties like this is pretty tricky, because of the fact that
some may be part of Access, even though they may not exist yet. This is an
area that people far more knowledgable than I tread lightly in. Who's to say
that when you go creating/setting properties from previous versions what
might happen? Who knows what properties are built-in but don't exist by
default (such as AllowBypass)? Who knows what kind of effect messing up
something like this may have? This isn't really something that you just jump
in and play around with... could be a bit dangerous to your project.
For example, from your oringal post...
dbs.Properties.Remove "AllowShortcutMenus"
you are not "setting" the property to False here, you are *completely
removing the property from the project!!!*. Just my opinion, but not a good
idea, I don't think.
This is the reason that most people tend to set them once, manually, and
then forget about it. Rarely do we find reasons to handle these things
programmatically.
Maybe this gives a little more light on why you can't use a one-liner to set
these. If you really insist on a one-liner, you're going to need your own
function to handle it...
SetProperty "propname"
SetProperty "someotherprop"
SetProperty "thatone"
Function Set Property(prop As String)
'do all your validating/creating here
'set your prop after you've validated it
End Function
To be insistent upon finding a one-liner of code to do what in fact requires
many lines of code with no getting around it the easy way is akin to
expecting your car to go gas itself after you park it if there's less than
quarter tank. Some things you just can't get away from.
--
Jack Leach
www.tristatemachine.com
"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)