text box

G

Glenn

Hi,

I have a textbox on a user form which is a date.
Currently user can put what they like in this field. Is
there a way where they must enter a date in XX/XX/XXXX
format
 
J

John Wilson

Glenn,

Really no need to "force" them to enter it in that format.
Check to see if it's a valid date and then format it for them.

Private Sub TextBox1_AfterUpdate()
If IsDate(TextBox1) Then
TextBox1 = Format(TextBox1, "mm/dd/yyyy")
Else
MsgBox "Please enter a valid date"
End If
End Sub

John
 
Top