Check box event

Super Suarez

Registered User.
Local time
Today, 09:55
Joined
Jul 10, 2013
Messages
36
Hi

I hope someone can help. I have a checkbox which when checked then turns textboxes to locked as below. However when I navigate to the next record which may not be checked the text boxes remain locked. I obviously want to lock the boxes depending on each record. I am navigating via the windows next/back record buttons. How do i do it?

Private Sub Check44_Click()
If Check44.Value = -1 Then
serial.Locked = True
gain.Locked = True
swst.Locked = True
Else
serial.Locked = True
gain.Locked = True
swst.Locked = True
End If
End Sub
 
Perhaps you need to run the code in the forms On Current event as well.
 
Expanding on what Bob mentioned..

Also, I find something weird with your piece of code.. Irrespective of the Checkbox's option, you Lock the controls..

Should it be the other way? Like.. If the CheckBox is Ticked you want the fields Enabled if not checked you want it to be disabled? If thats the case, use the following..
Code:
Private Sub Check44_Click()
    Me.serial.Locked = Me.Check44
    Me.gain.Locked = Me.Check44
    Me.swst.Locked = Me.Check44
End Sub 

Private Sub Form_Current()
    Me.serial.Locked = Me.Check44
    Me.gain.Locked = Me.Check44
    Me.swst.Locked = Me.Check44
End Sub
 
Also, I find something weird with your piece of code.. Irrespective of the Checkbox's option, you Lock the controls..
Well spotted Paul, that bit slipped right passed me:)
 
Yeah i had them set to true whatever. You do though need to run the function through a Private Sub Form_Current() function though from record to record. Thanks for the help guys, all working now.

Private Sub Check44_Click()
If Check44.Value = -1 Then
serial.Locked = True
gain.Locked = True
swst.Locked = True
Else
serial.Locked = False
gain.Locked = False
swst.Locked = False
End If
End Sub


Private Sub Form_Current()
Check44_Click
End Sub
 

Users who are viewing this thread

Back
Top Bottom