Toggle Button Caption change not right

G

Guest

I previously posted a question to "Change Toggle Button Caption" and recieved
a good example to make a toggle button (CustomerChkBx) change the caption
from "No"- not pressed in, to "Yes"- pressed in. Code as follows:

Option Compare Database
Public clicked As Boolean

Private Sub CustomerChkBx_Click()
If clicked = True Then
Me.CustomerChkBx.Caption = "No"
clicked = False
Else
Me.CustomerChkBx.Caption = "Yes"
clicked = True
End If

End Sub

I thought it worked fine however, when I go to the next record the toggle
buton retains the label from the previous record. If I press the button in
the caption goes from "No" to "Yes" as it is supposed to and it will change
back and forth each time it's pressed. But, when I got to the next record the
button will read what ever the last state was. So if I press the button it
will read "Yes" and shows that it's pressed in then when I go to the next
record the caption will read "Yes" and the button will not be pressed in. If
I then press the button it will change the caption to "No" and show that it
is pressed. Isn't there a way I can reset it for the next form to "No" so my
form works.
 
G

Guest

I was storing a check and I changed it to be:
CustomerChkBx= "Yes/No" Data type, "True/False" Format, "Text Box" Display
Control
and the result is still the same I get a "No" for the caption no matter what
I do. It does store the proper value though.

Lynn Trapp said:
Are you storing a true/false value for [clicked] in your table?

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm
Jeff Conrad's Access Junkie List:
http://home.bendbroadband.com/conradsystems/accessjunkie.html



laser02910 said:
Thanks for the resonses Lynn! Now the caption is "No" no matter what.
 

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