I have one of those unanswerable 'why' questions.
The 'control wizards', like for buttons and such, make extensive use of the
'DoCmd' keyword.
E.g. if you use the button wizzard to add a button to a form, and tell the
wizard that you want that button to open up a form, you get VBcode that says:
"DoCmd.OpenForm stDocName, , , stLinkCriteria"
Now, since 'DoCmd' is one of the MANY functions/expressions that are blocked
by 'sandbox mode', how are we supposed to re-write the code to make a button
open up a particular form in a way that *won't* get blocked by sandbox mode?
(and here comes the unanswerable 'why') Why would the wizards still use
'dangerous expressions' to do what needs doing? (Or is there no better way,
and MS is merely trying to feed more money to the third-party certificate
authorities?)
We aren't nearly big enough to need a Certificate Authority.
Is there a way to use a 'self-certified cert'?
I'd like to not have to turn off sandbox mode just to be able to run my own
code! So if I could re-write the code to comply with the sandbox rules,
that'd be great. So how do I get VBcode to open a form without using 'docmd.
openform'?
(If I wrote a WSH-type script to turn the sandbox on or off via the registry,
would a user without admin rights be able to do that? Or would I need some
sort of 'run as...' thing?)
jk
Rick Brandt - 14 May 2008 23:32 GMT
> I have one of those unanswerable 'why' questions.
>
[quoted text clipped - 30 lines]
>
> jk
I just set macro security to low and forget about it. In Access 2007 you
just set the folder to be a trusted one for the same effect.
The idea that people need to be protected from their own Access files is
idiotic.

Signature
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Tom van Stiphout - 15 May 2008 05:05 GMT
An alternative to DoCmd.OpenForm is:
First Create a global variable referencing the form:
global g_frmSomeForm as frmSomeForm
Then when you want to open the form:
set g_frmSomeForm = new frmSomeForm
g_frmSomeForm.Visible = True
-Tom.
>I have one of those unanswerable 'why' questions.
>
[quoted text clipped - 28 lines]
>
>jk
lyle fairfield - 15 May 2008 10:32 GMT
In Northwinds 2007 these lines are equivalent.
DoCmd.OpenForm "Inventory List"
[Form_Inventory List].Visible = True
It's not necessary to create a pointer to the form, but it is
necessary that the form have its "HasModule" property set to True, or
that form has a Module, some code behind the form. Pointers can be
useful when we want multiple but identifiable instances of the form,
that is an array of instances of the form. A handy attribute of this
is that we can caption the forms individually, and close them all with
one Erase statement.
I'm with Rick on this; why cripple JET unless you're in the habit of
opening unknown MDBs, or MDEs? If MS truly wanted to help with the
problems this is intended to prevent they could replace VBA as the
scripting language for Access. The Neanderthal like qualities of
commands like Kill have been mentioned in posts here in CDMA for
years. Would anyone today include such a dangerous command without
building in a checking,"Do you really wanna?" and a recovery
mechanism? MS's response Is Null!
Lastly why did MS call this nonsense "Sandbox" mode. My notion of a
sand box is that it's a place to store changes until they can be
verified and either approved and accepted, or rejected and expunged.
What's Sandbox about crippling the language?
> On Wed, 14 May 2008 16:44:32 GMT, "james_keegan via AccessMonster.com"
>
[quoted text clipped - 42 lines]
>
> >jk