Show Form IF VBA disabled for database (Access 2007)

enfinity

Registered User.
Local time
Today, 12:32
Joined
May 31, 2007
Messages
35
Hi *,

I recently found an Access database that shows a form at startup ONLY IF VBA is disabled (user has to click on 'Options' -> enable this content). Unfortunately, I'm not able to figure out how to implement this feature in my own database. I know how to setup a database with a static startup form but I don't know how to setup a form that comes up based on a condition (e.g. VBA content enabled/not enabled).

Any feedback greatly appreciated.

Thanks,
Steve
 
In the Form Open event on your "only if disabled" form:
Code:
'This will not run if VB is disabled.
docmd.openform frmFormIfEnabled,  acNormal
docmd.close acForm, frmFormIfDisabled 'Close this form since we don't need it.

This is air code (I don't know if it works and you'll need to supply your own object names) and is only here to display the concept.
 
Thanks georgedwilkinson! I think it is the standard case that Access 07 disables VBA content so this form will never run, right? I'm looking for a way to show a form if VBA content is disabled. The reason I want to do that is to give users instructions on how to enable VBA content.


An example can be found here:
http://mcfedries.com/Access2007Forms/examples.zip

In this example, the inital form comes up when VBA content is disabled. Unfortunately, I cannot figure out how this works!

Thanks again for your help!
Steve
 
I'm not sure if you still need help or not.

Yes, you understand the concept. The form you actually want to start the application can only load if VB is enabled, using the code I provided. Further, you might even want to hide the form(s) so the user can't invoke it directly (one method is naming them with a prefix of "usys").

You "start" the application with the form that explains how to enable content. You put the code I provided in the On Open event of that form.

Does that help?
 

Users who are viewing this thread

Back
Top Bottom