Solved

VBA: Loop through form checkboxes

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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…

770 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