Enable textboxes with checkbox

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!
 
G

Guest

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....
 
J

JustMe

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.
 
A

Annonymous

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!
 
G

Guest

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.
 
B

Bruce M. Thompson

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.
 
J

JustMe

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.
 
B

Bruce M. Thompson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top