Hello everyone. How can I use the BeforeUpdate of a textbox to force the textbox to only accept certain values in this case short hand dates: mm/dd/yyyy?
Hello everyone. How can I use the BeforeUpdate of a textbox to force the textbox to only accept certain values in this case short hand dates: mm/dd/yyyy?
You can try this:
![]()
Private Sub Textbox_BeforeUpdate() If Textbox.Value = "" Or Textbox.Text <> Format(Textbox.Text, "mm-dd-yyyy") Then MsgBox ("Enter a Valid Expiration Date (mm-dd-yyyy)") Textbox.Value = "" Cancel = True Textbox.SetFocus Exit Sub Else 'What to do (if anything) if valid. End if End Sub
Last edited by jeffreybrown; 02-05-2019 at 06:56 PM. Reason: Please use code tags!
Hi srpinaz,
Not sure Anthony is still waiting for an answer to this thread! However, if he is, his project is awfully delayed after 9 years. Anyway, please use code tags when posting code.
HTH
Regards, Jeff
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks