MrEGuest is right, I moved the code to the click event and the code below seems to test ok.
----------------------------------
Option Explicit
Function DollarAmtRqd(ByVal Value As String) As Boolean
If Value = "MTG" Then
DollarAmtRqd = True
Exit Function
ElseIf Value = "RGIC" Then
DollarAmtRqd = True
Exit Function
ElseIf Value = "NGIC" Then
DollarAmtRqd = True
Exit Function
ElseIf Value = "RMF" Then
DollarAmtRqd = True
Exit Function
ElseIf Value = "NMF" Then
DollarAmtRqd = True
Exit Function
ElseIf Value = "PAC" Then
DollarAmtRqd = True
Exit Function
ElseIf Value = "BT" Then
DollarAmtRqd = True
Exit Function
End If
End Function
'verify dollar amount is valid
Private Function IsValidDollarAmt(ByVal Amt As Variant) As Boolean
Dim TmpVal As Currency
On Error Resume Next
TmpVal = Amt
IsValidDollarAmt = Err.Number = 0
On Error GoTo 0
End Function
Private Sub Combo1_Click()
If DollarAmtRqd(Combo1.Text) = True Then
Command1.Enabled = IsValidDollarAmt(Text8.Text)
Else
Command1.Enabled = False 'Added this line
End If
End Sub
Private Sub Form_Load()
'For testing only
With Combo1
.AddItem "MTG"
.AddItem "RGIC"
.AddItem "NGIC"
.AddItem "RMF"
.AddItem "NMF"
.AddItem "PAC"
.AddItem "BT"
.AddItem "Different String" 'Dollar amt not rq'd
.AddItem "Another Different String" 'with these
End With
End Sub
Private Sub Text8_Change()
If DollarAmtRqd(Combo1.Text) = True Then
Command1.Enabled = IsValidDollarAmt(Text8.Text)
End If
End Sub
-----------------------------
The command button needs to be updated in both the combo_click() and the Text8_Change() events for it to work right. Lemme know if this doesn't do it, we're getting close
~Mike
Any man willing to sacrifice liberty for security deserves neither liberty nor security.
-Ben Franklin