Solved

VBA: Loop through form checkboxes

Posted on 2001-06-05
3
1,612 Views
Last Modified: 2006-11-17
Hi,

After providing my user with about 100+ checkboxes to apply criteria to a query, now she complains that it is tedious to uncheck the check boxes.

It sure would be easier to just close the form and start again, but no!

Using VBA, is it possible to loop through all the checkboxes and un-check them?

Notes:
The checkboxes are all on one form, divided into different sections on tab control pages. They only need to be unchecked.
0
Comment
Question by:sthornton
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
dovholuk earned 100 total points
ID: 6158018
you could use this type of routine to uncheck ALL the checkboxes on a form:

Dim c As Control

For Each c In Me.Controls
    If c.ControlType = acCheckBox Then
        c = False
    End If
Next c

put this code behind a button (or whereever you want)

let me know if you need more help.

dovholuk
0
 
LVL 5

Expert Comment

by:vsamtani
ID: 6158042

Just put this code snippet in the OnClick event procedure for a "Clear all checkboxes" command button, or wherever else is appropriate:


  Dim ctl As Control
  For Each ctl In Me.Form.Controls
    If ctl.ControlType = acCheckBox Then ctl=False
  Next ctl




Vijay

0
 
LVL 5

Expert Comment

by:vsamtani
ID: 6158046
Ah - should have refreshed the question before posting. Anyway, it's reassuring that the two answers are identical...

:)

Vijay
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question