By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,611 Members | 1,468 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,611 IT Pros & Developers. It's quick & easy.

How to auto uncheck boxes in Access

P: 72
Hi Everyone,

Not sure the following is possible to do.

The standard MS Access user interface has checkboxes on a number of menu pages, such as Tools/Options/View. I have been asked to find a way to automatically uncheck these controls by writing either a macro or module using VBA or any other method.

The idea is that the user, with limited access rights and technical know how, opens Access and just run a macro or click something to uncheck the checkboxes.

This question is not so much about running a macro or module but about writing some auto process to uncheck the checkboxes although it may or may not involve using macros or modules to do it.

Also, do these standard menu pages, eg Tools/Options/View, have names that can be referenced, eg viewForm.checkboxXX.checked = false

Any help would be appreciated
Denis
Jun 14 '09 #1
Share this Question
Share on Google+
14 Replies


ADezii
Expert 5K+
P: 8,680
@dragon52
To programmatically control all the Options in the
Tools ==> Options ==> View ==> Show Tab:
Expand|Select|Wrap|Line Numbers
  1. 'Uncheck ALL Check Boxes
  2. Application.SetOption "Show Status Bar", False
  3. Application.SetOption "Show Startup Dialog Box", False
  4. Application.SetOption "Show New Object Shortcuts", False
  5. Application.SetOption "Show Hidden Objects", False
  6. Application.SetOption "Show System Objects", False
  7. Application.SetOption "ShowWindowsInTaskbar", False
  8. Application.SetOption "Show Macro Names Column", False
  9. Application.SetOption "Show Conditions Column", False
  10.  
  11. '******** To Control Click Options in Database Window *******
  12. 'To Single-Click Open
  13. Application.SetOption "Database Explorer Click Behavior", 0
  14. 'To Double-Click Open
  15. Application.SetOption "Database Explorer Click Behavior", 1
  16. '************************************************************
Jun 14 '09 #2

NeoPa
Expert Mod 15k+
P: 31,712
If you press F1 on the word SetOption then it will open the Context-Sensitive help page which contains a link to another page where the usable values are listed.

If the changes are, Big-Brother like, to be assigned permanently, then SetOption is fine. Should you require to make the changes just for the session, then use GetOption to save the current settings before the change is made, and set them back to their previous values upon completion.
Jun 15 '09 #3

P: 72
Hi guys,

Thanks a lot for your responses. You gave me exactly the info I needed.

I have attached the VBA code to a button on a form which in turn is attached to a new menu item on the toolbar. It works.

I am wondering if it is possible to attach the VBA code directly to the menu item I have created. Just want to make it a little more elegant (user friendly).
Jun 15 '09 #4

NeoPa
Expert Mod 15k+
P: 31,712
Pleased to hear we've helped :)
@dragon52
Do you mean programatically, or manually.

The answer is that it's certainly possible. To start Right-Click on the toolbar area and explore Customise....

Let us know where, from there, you're thinking of going.
Jun 15 '09 #5

ADezii
Expert 5K+
P: 8,680
@dragon52
I am wondering if it is possible to attach the VBA code directly to the menu item I have created.
Definately so. The most elegant manner would probably be to encapsulate the code within a 'Public' Function, then set the Function Name as the On Action Property of the Menu Item. The syntax for this must be =fFunctionName().
Jun 15 '09 #6

P: 72
I've got it !

I have put the Public function in a module and then assigned "=Uncheck()" to the OnAction attribute of the menuItem.

It works beautifully.

Thanks a lot guys
Jun 16 '09 #7

ADezii
Expert 5K+
P: 8,680
@dragon52
You are quite welcome. You also could have set On Action = <Macro Name> whereas the Macro would call the Public Function, but I feel that this approach is more efficient and direct.
Jun 16 '09 #8

P: 72
ADezii, NeoPa,

Hey guys, need to pick your brains again!

This process of unchecking controls, they think clicking the menu to do it is too involved for the users. Is it possible to attach the VBA code to the "on open" event of the Access app? Not the "OnOpen" event of a form but when Access starts. This way there is no user intervention at all.

Is there such an event that is programmable? If so can you give me a clue how to get to the editor for this event?

I have experimented and managed to do it for the OnOpen event of a form but they like something better still.

thanks
Jun 20 '09 #9

ADezii
Expert 5K+
P: 8,680
@dragon52
  1. Create a Macro and Name it AutoExec.
  2. Set the Action Argument to RunCode.
  3. Set the Function name to Uncheck() - (no equal sign).
  4. Save the AutoExec Macro.
  5. When your Database is initially Opened, the AutoExec Macro will automatically be executed producing the desired effect.
Jun 20 '09 #10

P: 72
Fantastic thanks, ADezii
Jun 20 '09 #11

ADezii
Expert 5K+
P: 8,680
@dragon52
You are quite welcome.
Jun 20 '09 #12

NeoPa
Expert Mod 15k+
P: 31,712
Most experienced developers (ADezii is an exception - he certainly qualifies as experienced but finds macros less distasteful) foreswear the use of macros completely.

If, like me, you prefer to use VBA code exclusively to control your project then an alternative would be :
  1. Create a form.
  2. Using Tools / Startup set this form to open automatically when the project opens.
  3. Put your VBA code in the OnOpen event procedure of this form.
Bob's your uncle.
Jun 22 '09 #13

ADezii
Expert 5K+
P: 8,680
@NeoPa
For the Record, NeoPa, there are only 2 Macros that I ever use and they are AutoExec and AutoKeys. I find them both very useful, and despite ominous warnings from Microsoft, I don't think that they will be going away anytime soon. Take care.
Jun 22 '09 #14

NeoPa
Expert Mod 15k+
P: 31,712
That wasn't intended to sound critical at all. It was more that you show more patience with them (macros - hawk / spit) than I do :D
Jun 22 '09 #15

Post your reply

Sign in to post your reply or Sign up for a free account.