Solved

VBA: Loop through form checkboxes

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

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
Comment Utility
Ah - should have refreshed the question before posting. Anyway, it's reassuring that the two answers are identical...

:)

Vijay
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…

763 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

12 Experts available now in Live!

Get 1:1 Help Now