Checkbox

James007

New member
Local time
Today, 01:09
Joined
Jun 8, 2012
Messages
8
Just wondering how I could use a checkbox to double a number in a txt box when it is clicked.

Thanks for your help.
 
Air code example (checkbox After Update event);

Code:
Private Sub chkYourCheckBox_AfterUpdate()

With Me
    If !chkYourCheckBox = True Then
        If IsNumeric(!txtYourTextBox) Then
            If !txtYourTextBox > 0 Then !txtYourTextBox = !txtYourTextBox * 2
        End If
    End If
End With

End Sub
 
This works good, but what if it is unchecked and you want it to go back to the original number is there a workaround for that problem.:eek:
 
Try this modified version of the procedure.

Code:
Private Sub chkYourCheckBox_AfterUpdate()

With Me
    If IsNumeric(!txtYourTextBox) And !txtYourTextBox > 0 Then
        If !chkYourCheckBox  Then
            !txtYourTextBox = !txtYourTextBox * 2
        Else
            !txtYourTextBox = !txtYourTextBox / 2
        End If
    End If
End With

End Sub
 
This worked great!!!! Thanks for the help, you saved my hair. Thanks....

:)
 

Users who are viewing this thread

Back
Top Bottom