yes/no box and text box

G

Guest

Can you have a yes/no box work in such a way that when the agent selects yes
and checks off the box, the number 4 is placed in a text box? If this doesnt
make sence i will try better to explain.
 
D

Douglas J. Steele

You can put code in the AfterUpdate event of the check box to determine
whether or not it's set, and place the 4 in the text box:

Private Sub MyCheckBox_AfterUpdate

If Me.MyCheckBox = True Then
Me.MyTextBox = 4
Else
Me.MyTextBox = Null
End If

End If

Presumably you're only going to be storing the 4 in the table: it would be
redundant to store that and the True from the check box.
 
G

Guest

Doug,
Thanks for the quick feedback and i have that working . I only want to
store the number in my table since the textboxes are being used to calculate
a quality assurance scorecard. One question though, how do i set my table up
so that the 4 from my checkbox only goes to my table? Thanks again
 
G

Guest

Don't understand the question. A form is a window to the table and whatever
you type into a bound field is stored in the table.

Can you explain?
 
G

Guest

My mistake i had the properties of the textbox unbound and it was just
showing it in my form but not storing it. I changed the control to be = to
my correct table field and now it is storing the value. I appreciate all
your feedback!
 
G

Guest

Once you mark the checkbox as yes it calculates the points. When you leave
the record and go back the checkbox is unchecked but the value is still in
the textbox. Is there any way that the checkbox can stay marked off?
 
G

Guest

Ops it is because the checkbox is not being stored anywhere. Please ignore
my previous comments as i need to drink my coffee
 
D

Douglas J. Steele

Actually, if you want the checkbox to show up as checked when the textbox
contains 4, you can put code in the form's Current event:

Private Sub Form_Current()

Me.MyCheckBox = (Me.MyTextBox = 4)

End Sub
 

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