PDA

View Full Version : textbox with date variable?



johnnyexit
09-17-2015, 12:38 AM
hi,

I have a text box with variable:

startDateTime = UserForm1.TextBox1

and start DateTime is a Public startDateTime As Date.

When a suddenly put any letter it gives me an error. Is it possible if I put any letter to give me
a note "wronf format" and return me back to input a textbox?

mancubus
09-17-2015, 04:57 AM
with a quick search in Google:

http://blog.oppoin.com/cookbooks/buttons-forms-and-charts/lesson-22-validate-data-from-userform-how-to-trigger-validation/
scroll down to title: c) Trigger when you leave the TextBox

mikerickson
09-17-2015, 07:02 AM
Dates entered into text boxes are very complicated. It might be best to replace that text box with three drop downs (day, month, year).