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!

Problem with check boxes

Status
Not open for further replies.

tfujino

Programmer
Apr 10, 2001
22
0
0
US
Hi - hope someone can help me with this. I have an application that tracks/calculates charges and contract information. I have two check boxes for optional charges. If the user checks a box, the optional charges are visible, otherwise the charges are not visible. I have this code on the click event of the check box.

The problem is that when I navigate through the records, if I have checked the box in the first record, the charges are visible in all the subsequent records. I have tried to correct this using the form current event and the form dirty event, but it still does not correct this.

An example of the code I'm using is:

If checkbox.Value = -1 Then
label.Visible = True
textbox.Visible = True


ElseIf checkbox.Value = 0 Then
label.Visible = False
textbox.Visible = False
End If

Does anyone know how to correct this?

Thank you in advance for your help!
 
Have you tried putting a me.refresh behind the statement in the form current? I know that has worked for me in the past. I have a book at home that talks about this and will try and research this example, because they site this exact problem. I won't be able to post until later tonight or tomorrow, If I can find the book.
 
Is your checkbox bound, and does It change as you navigate the records?
 
In the form's "On Current" event, put a call to your code

Call MyCheckbox_AfterUpdate


This will run every time you move to a new record or create a new record. If the record is blank(ie New), the record will display the defaults. If you are scanning through existing records, it will display the correct settings for that record.

HTH
Lightning
 
suggestion:

try using AfterUpdate event instead of OnClick, then try this code:

if checkbox.value = True then
Label.Visible = True
TextBox.Visible = True
else
Label.Visible = False
TextBox.Visible = False
End If


...it works for me! :)
 
Thanks for all the suggestions - I will try them out :).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top