473,396 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

What is the best way to validate a TextBox for Date input using VBA?

What is the best way to validate a TextBox for Date input using VBA. How to code date inputmask in vba
Dec 12 '10 #1
1 2495
Guido Geurs
767 Expert 512MB
Expand|Select|Wrap|Line Numbers
  1. Private Sub CommandButton1_Click()
  2.    If TextBox1 = vbNullString Then Exit Sub
  3.    If IsDate(TextBox1) Then
  4.      TextBox1 = Format(TextBox1, "Short Date")
  5.    Else
  6.      MsgBox "Non valid date"
  7.      Cancel = True
  8.    End If
  9. End Sub
Dec 13 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Rob | last post by:
I have a date text box (input type = text) in an ASP.NET/Javascript environment. I wanted to force the users to enter dates in a "__/__/____", "dd/mm/yyyy" or similar format. The textbox needs to...
2
by: Grey | last post by:
I want to know that how to valiate date input from ASP.NET? can i use custom validator? if so, how to.. Million Thanks.
1
by: Grey | last post by:
how to use Custom Validator to valid the date input, such as Feb does not have 30th or April does not have 31st.... I don't want to use Calender control...
6
by: RSB | last post by:
Hi Every one Need some help to Validate the Date i have in the Form. ALso how to Convert the Date Data i read from table to yyyy/MMM/dd format. Thanks RSB
3
by: Sunil | last post by:
Hi, I have a from with around 8 date fields. All these are entered by the user and are to validated for holidays. The holiday validation can only be done on server side. I am planning to use...
3
by: samuelberthelot | last post by:
Hello, I would like to validate a date in a textbox on the onChange event. The date must be in the format 01/01/2007 I would like to use a regular expression to validate it but I'm not very...
1
by: lyealain | last post by:
how do i validate the date inserted from textbox to check whether that is follow the date requirement... i wrote this... if not (isnumeric(inserteddate)) then if isdate(inserteddate) then ...
3
by: gayano | last post by:
Hi, I'm using Visual studio 2005 pro Ver..]]] I have a Form named form1 textbox named txtName masked textbox (Date Masked) named txtMaskedDate and a button to add data named btnAdd dim...
9
by: dragon52 | last post by:
Hi all, I want to validate on the client side and I have the following php code (tbxBirthDate is the text box, ie name="tbxBirthDate") with(window.document.enrollForm) { . ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.