Data Validation When ComboBox Value Changes

reberryjr

Well-known Member
Joined
Mar 16, 2017
Messages
701
Office Version
  1. 365
Platform
  1. Windows
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
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,214,987
Messages
6,122,613
Members
449,090
Latest member
vivek chauhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top