![]() |
UserForm text box Date formatting
I have a UserForm textbox being used to capture a date. I
want to stop the user, on the UserForm, if the date is not inputed correctly (01/01/04) or if a non-date is inputed. Last night, I had a suggestion to use the IsDate function but I am a newbie. Is the "Input Mask" feature, used in MS Access, available in VBA? Can you give me suggestions on how to use IsDate or a better solution? Thanks. |
UserForm text box Date formatting
userform controls have no mask or validation capabilities inherent in their
properties or methods. Private Sub Textbox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) sStr = Userform1.Textbox1.Text if not isDate(sStr) then Userform.Textbox1.Text = "" msgbox "Bad date in Textbox1" cancel = True end if End sub -- Regards, Tom Ogivy "Dan" wrote in message ... I have a UserForm textbox being used to capture a date. I want to stop the user, on the UserForm, if the date is not inputed correctly (01/01/04) or if a non-date is inputed. Last night, I had a suggestion to use the IsDate function but I am a newbie. Is the "Input Mask" feature, used in MS Access, available in VBA? Can you give me suggestions on how to use IsDate or a better solution? Thanks. |
UserForm text box Date formatting
Thanks Tom, you have been big help. Dan
-----Original Message----- userform controls have no mask or validation capabilities inherent in their properties or methods. Private Sub Textbox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) sStr = Userform1.Textbox1.Text if not isDate(sStr) then Userform.Textbox1.Text = "" msgbox "Bad date in Textbox1" cancel = True end if End sub -- Regards, Tom Ogivy "Dan" wrote in message ... I have a UserForm textbox being used to capture a date. I want to stop the user, on the UserForm, if the date is not inputed correctly (01/01/04) or if a non-date is inputed. Last night, I had a suggestion to use the IsDate function but I am a newbie. Is the "Input Mask" feature, used in MS Access, available in VBA? Can you give me suggestions on how to use IsDate or a better solution? Thanks. . |
All times are GMT +1. The time now is 06:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com