Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visible/hidden yes/no fields and vba to autodetect them

Status
Not open for further replies.
Sep 10, 2002
150
US

I have a few yes/no(true/false) fields in a form which are either visible or hidden based on other criteria in the database. I would like a vba script to do the following:

return an integer (variable) of the total number of hidden fields that = true
and then: Make all hidden fields = false

If I can accomplish this with a query easier than script, that's fine too, but all of these are fields on the same record.

Thanx in advance!!
 
Something like...
Code:
Dim ctl as Control
Dim Count as Integer

For each ctl in Me.Controls
  if ctl.ControlType=acCheckbox then
    if ctl.visible=false then
      if ctl=true then
        count=count+1
        ctl=false
      end if
    end if
  end if
next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top