PDA

View Full Version : Solved: Enable Button Criteria



av8tordude
02-29-2012, 01:51 PM
In the userform, a name must be selected in the txtOcc, last 4 number entered in txtSSN and at least 1 checkbox must be checked. If any these items mention complied with, the "Print" Button should be disabled.

I manage to accomplish txtOcc, txtSSN, & Form 2106 ckbox. Unfortunately I can't seem to get the other checkboxes to work. Currently, if txtOcc or txtSSN is completed and I check either of the remaining checkbox, it enables the the "Print Button".

for example, select Name1, leave txtSSN blank, then check Vehicle Expense. The "Print" button gets enabled when it not suppose to since txtSSN is empty.

Can someone assist. Thanks

mdmackillop
02-29-2012, 04:13 PM
Private Sub ck2106_Click()
ChkVal
End Sub

Private Sub ckEER_Click()
ChkVal
End Sub

Private Sub ckMER_Click()
ChkVal
End Sub

Private Sub ckVER_Click()
ChkVal
End Sub

Private Sub txtOcc_Change()
ChkVal
End Sub

Private Sub txtSSN_Change()
ChkVal
End Sub

Function ChkVal()
Dim a&, b&, c&, d&, e&, f&, x&
a = 1 * (txtOcc <> "")
b = 1 * (txtSSN <> "")
c = 4 * ck2106
d = 4 * ckMER
e = 4 * ckEER
f = 4 * ckVER
x = a + b + c + d + e + f
If x Mod 4 = 0 Then
Ent1.Enabled = False
Else
If x <= -6 And x Mod 2 = 0 Then
Ent1.Enabled = True
Else
Ent1.Enabled = False
End If
End If
End Function

av8tordude
02-29-2012, 04:34 PM
Thank you Mack. It works great! :friends: :beerchug: