text box

  • Thread starter Thread starter Glenn
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top