Data Validation When ComboBox Value Changes

reberryjr

Active Member
Joined
Mar 16, 2017
Messages
483
I'm adding some validation to a UserForm and can't seem to come up with a good approach on one topic. If the cobo_Status field is changed from Inactive to Active, I want to make sure that there is a date entered into the txt_1stPymt box. How can I code it to say something to the effect of If me.txt_DPStartDate <= Today Then me.txt_1stPymt can't be Null?

Here's what I have so far, but it won't work, since it's always looking for a value in the txt_1stPymt box, if the cobo_DPStatus = Active.

Code:
If frm_UpdateServices.cobo_DPStatus = "Active" And Len(frm_UpdateServices.txt_DPStart) = 0 Or _     Not IsDate(frm_UpdateServices.txt_DPStart) Or Len(frm_UpdateServices.txt_DP1stPymt) = 0 Or _
     Not IsDate(frm_UpdateServices.txt_DP1stPymt) Or Not IsNumeric(frm_UpdateServices.txt_DPPymtAmt) Or _
    (frm_UpdateServices.txt_DPPymtAmt) < 1 Or Len(frm_UpdateServices.cobo_DPFreq) = 0 Then
        MsgBox "Please correct the Client's Diet Plan information."
        If Response = vbOK Then
            frm_UpdateServices.cobo_DPStatus.SetFocus
        End If
        Exit Sub
End If
 

Forum statistics

Threads
1,085,300
Messages
5,382,796
Members
401,806
Latest member
Ntb

Some videos you may like

This Week's Hot Topics

Top