Check Date Format (In Textbox)

This checks that a date has been entered into a textbox and formats it correctly for the user.

Private Sub dteDate_Exit(ByVal Cancel As MSForms.ReturnBoolean) 'Check to ensure only a date is entered into the system and formats it correctly before sending it to db With dteDate If IsDate(.Text) Then 'Format Date .Text = Format$(.Text, "dd/mm/yyyy") ElseIf dteDate = "" Then MsgBox ("Please enter a date in format DD/MM/YYYY") Else 'Error & Clear MsgBox ("You have not entered a valid date. Please enter in format DD/MM/YYYY") Cancel = True End If End With End Sub

Code Snippits