Hi,
In a form, I have a field that use DTPicker to let user select the date. How can I prevent the user pick the weekend (like sat, sun).
Thanks!
Printable View
Hi,
In a form, I have a field that use DTPicker to let user select the date. How can I prevent the user pick the weekend (like sat, sun).
Thanks!
Code:If Weekday(Text1.Text) = vbSunday Or Weekday(Text1.Text) = vbSaturday Then
MsgBox "The Date cannot be a Saturday or Sunday.", vbOKOnly + vbExclamation, "Invalid Date"
Text1.Text = vbNullString
Exit Sub
End If
Just modified Hack's to use the dtpicker. :PCode:If Weekday(dtPicker.Value) = vbSunday Or Weekday(dtPicker.Value) = vbSaturday Then
MsgBox "The Date cannot be a Saturday or Sunday.", vbOKOnly + vbExclamation, "Invalid Date"
dtPicker.Value = now()
Exit Sub
End If
:blush: That was actually taken directly from one of my projects in which I use a dtpicker.Quote:
Originally Posted by Besoup
I changed the control names to make it more generic, but I think I generized it a bit too much.
Takes Besoup! :o