Data Validation When ComboBox Value Changes

reberryjr

Active Member
Joined
Mar 16, 2017
Messages
499
Office Version
  1. 2013
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
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Watch MrExcel Video

Forum statistics

Threads
1,122,228
Messages
5,594,934
Members
413,953
Latest member
Arthur1471

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
Top