Enable textboxes with checkbox

  • Thread starter Thread starter Annonymous
  • Start date Start date
A

Annonymous

How can I enable (unhide) a textbox on a form if a checkbox is checked. My
checkbox is bound to a yes/no on a table. I get it to work but only as I
scroll through each record. I want to be able to toggle the textboxes with
the checkbox.

Thanks!
 
Can't you just evaluate the value of the yes/no field and
make the text box visible/invisible?

if y/n = true
me.txtbox.visible = true....
 
i'm not following you. I am trying to do a very similar thing and when
I see the properties of a field on the form, the "Visible" option only
allows me Yes or No. "Display When" offers me similar results, saying
that I can only select from the options provided.
 
Bear with me, I'm new at this,

Would the code be for the form or the checkbox? Also, what event would it
be for (Click, AfterUpdate, etc.)?

Thanks!
 
You could do the on form open, on change event for some
field (since you want to cycle through all records, this
might be a key field), but I was talking about coding it
in VBA, rather than using the form properties. Sorry I
didn't make that clear.
 
How can I enable (unhide) a textbox on a form if a checkbox is checked. My
checkbox is bound to a yes/no on a table. I get it to work but only as I
scroll through each record. I want to be able to toggle the textboxes with
the checkbox.

Example code:

'***
Me.TextBoxName.Visible = Me.CheckboxName.Value
'***

The code should be placed in the checkbox's "AfterUpdate" event procedure.
Replace "TextBoxName" with the name of the textbox and "CheckboxName" with the
name of the checkbox.
 
what if that field is in another table?


Example code:

'***
Me.TextBoxName.Visible = Me.CheckboxName.Value
'***

The code should be placed in the checkbox's "AfterUpdate" event procedure.
Replace "TextBoxName" with the name of the textbox and "CheckboxName" with the
name of the checkbox.
 
what if that field is in another table?

Obviously, if that field is not displayed on the form, that code has nothing to
work with; the code does, however, do what you asked for and the location of the
field is of no consequence as long as it is contained in the form's recordsource
and it is displayed via a textbox on the form.
 
Back
Top