Hello,
I have a User Form with a DatePicker. I want to Add validation so that only future workdays can be selected (excluding both weekends and Holidays).
DTPickerLaunch currently defaults to today's date. I got as far as to validate that the field is changed but that was it. My code for the Command button is below.
Can someone help me to update the validation with the above criteria?
I have a User Form with a DatePicker. I want to Add validation so that only future workdays can be selected (excluding both weekends and Holidays).
- Date Picker name = DTPickerLaunch
- Validation occurs on command: Private Sub CommandButtonContinue_Click()
- List of Holidays is located at 'Dropdown Values'!$J$19:$J$48
DTPickerLaunch currently defaults to today's date. I got as far as to validate that the field is changed but that was it. My code for the Command button is below.
Can someone help me to update the validation with the above criteria?
Code:
'When Click Continue from main page
Private Sub CommandButtonContinue_Click()
'Check for Required Fields
With Me
If .TextBoxProductName.Value = "" Then Msg = Msg & "Product Name is required" & vbLf
If .DTPickerLaunch = Date Then Msg = Msg & "Launch Date is required" & vbLf
If .ComboBoxAffiliation = "" Then Msg = Msg & "Product Affiliation is required" & vbLf
If .ComboBoxLabel = "" Then Msg = Msg & "Sdditional Product Label is required" & vbLf
If .ComboBoxBrand = "" Then Msg = Msg & "Product Brand is required" & vbLf
If .ComboBoxProductType = "" Then Msg = Msg & "Product Type is required" & vbLf
If .ComboBoxProductType2 = "" Then Msg = Msg & "Indicate if Special/Hard Ticket Event is brand new" & vbLf
If .ComboBoxMediaNeeded = "" Then Msg = Msg & "Indicate if Media is needed" & vbLf
End With
'That one option is checked for Product Contains
For Each Ctrl In FrameChannels.Controls
If TypeOf Ctrl Is MSForms.CheckBox Then
If Ctrl.Value = True Then
F1D = True
Exit For
End If
End If
Next Ctrl
If F1D = False Then
Msg = Msg & "Selected at least one Product Channel (Pick all that Apply)"
End If
'Create one msg for all errors
If Len(Msg) > 0 Then
MsgBox Msg
Exit Sub
End If
'Page Navagation
If ComboBoxProductType = "Special Offer" Then
MultiPage1.Value = 3
Else
MultiPage1.Value = 4
End If
End Sub
Last edited: