Hey guys,
I am trying to write a code that will identify an invalid date format in the textbox, give the user a message and then go back to the date textbox and highlight the whole text. Here is my code:
[VBA]Private Sub txtTransactionDateExp_AfterUpdate()
With txtTransactionDate
If IsDate(.Text) Then
.Text = Format(.Text, "Short Date")
Else
MsgBox "Transaction Date format is incorrect. Standard format is mm/dd/yy."
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End If
End With
End Sub[/VBA]
My problem is that after the message box, the cursor just goes on to the next field (does not go back and highlight the date field).
Please help ,
Dimitriy