"Jim Devenish" <in***************@foobox.comwrote in message
news:91**********************************@c58g2000 hsc.googlegroups.com...
>I wish to control which users can and cannot alter the toolbars. The
opening popup window invites them to login. Immediately after this, I
have the code:
CurrentDb.Properties("AllowToolbarChanges") = isManager
CurrentDb.Properties.Refresh
isManager is a function that returns true/false
This works (up to a point) but I am caught by the final line in the
Help that says:
"This property's setting doesn't take effect until the next time the
database opens"
So, it would seem that I have to quit the database and get the user to
log in again. (But then, of course, not repeat this procedure!)
Is there any way in which this change can be made for the current user
without them having to log in again?
Or is it possible to quit and then (from code) automatically log that
user in again?
You can't just set a custom object property without first creating it.
Here's a module which will give you the ability to set, get and delete
object properties:
http://www.smccall.demon.co.uk/Objects.htm#ObjFuncs
Using that, all you need is:
SetObjProp CurrentDb, "AllowToolbarChanges", True
then, to verify it:
Debug.Print GetObjProp(CurrentDb, "AllowToolbarChanges", false)
Result: True
Notice that the line in help that you mentioned is *wrong*. As soon as you
either create or alter an object's properties, the changes are made
available. They will survive a database restart, though.
Also if you're going to refresh the properties collection (I've never found
it to be necessary), you're better off doing it before the assignment rather
than afterward.