Solved

VBA: Loop through form checkboxes

Posted on 2001-06-05
3
1,585 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
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…

914 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now