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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Boxes appear on a form if a box is checked 1

Status
Not open for further replies.

psbrum01

Technical User
Oct 10, 2008
8
0
0
US
I am designing a form and would like to display combo and text boxes only if a particular check box is clicked.

How should I go about this?
 
First, learn how to provide better specs. Tell us about your form and data. Is the check box bound? By "clicked", do you actually mean "checked"?

Is the form continuous or single? Do you know how to write VBA code?

Duane
Hook'D on Access
MS Access MVP
 
Thanks for the patience Duane, I am new to designing Access databases.

The check box is bound. I want to show certain boxes when the check box is checked (I am attaching a picture).

The form is single.

I do not know VBA but I am a quick learner.

 
 http://www.box.net/shared/u7cgdevtfp
I would start by entering something into the Tag property of each control you want to hide. Then add code to the form module that loops through the controls looking for the tag and setting the visible property based on the value of the yes/no field.

Code:
Sub HideSoldering()
  Dim ctl as Control
  For Each ctl In Me.Controls
     If ctl.Tag = "Hide" Then
         ctl.Visible = (Me.chkSolderingTest = True)
     End If
  Next
End Sub

You could then call this sub in the On Current event of the form and also the After Update event of the check box.

Duane
Hook'D on Access
MS Access MVP
 
In the Current event procedure of the form and the AfterUpdate event procedure of the checkbox:
Me![your combo name].Visible = Me![your checkbox]
Me![your textbox name].Visible = Me![your checkbox]
...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I am going to try dhookom's suggestion. PHV I tried yours but bound checkboxes don't appear to event procedures.

Thanks
 
bound checkboxes don't appear to event procedures
????
 
Which line of code is highlighted when in debug mode at the time the error raises ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Me![Soldering Method].Visible = Me![Soldering Test]

[Soldering Method] is a combo/list box on the form and it is fed by the table [Soldering Method] which is a text field.

[Soldering Test] is a field that is used as a check box.

Is there something specific in the properties of [Soldering Test] is should change so I don't get this error?

Thanks
psbrum01
 
I think you may have some confusion with control and field names.

You should try to rename your combo box to cboSolderingMethod and your check box to chkSolderingTest. Then change the code to:
Code:
Me![cboSolderingMethod].Visible = Me![chkSolderingTest]


Duane
Hook'D on Access
MS Access MVP
 
This is fairly straight forward code. Please confirm:
1) you have a checkbox named chkSolderingTest bound to your yes/no field
2) you have a combo box named cboSolderingMethod

Did you try my solution?
Can you always reply with the entire sub or function that is causing the error?

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top