CodeWidgets.com Online Source Code Library -ASP, ASP.NET, VB, VB.Net, Microsoft® Access, Javascript, VBScript, Website Design, Web Applications, Custom Programming Services Available.

 CodeWidgets.com ASP, ASP.NET, VB, VB.Net,
Microsoft® Access, Javascript, VBScript,
Website Design, Web Applications
Shopping Cart (0) Items $0.00      
 CodeWidgets.com
CodeWidgets.com

 

Website Stats to Date

Pages Viewed 4,401,732
Visitors 1,206,536
Widgets Viewed 3,009,755
Since January 1/2003
 
 
Active Users: 17
 

 
PayPal: Secure online payments!
 
Widget #CS0163

Date Validation Function (Microsoft® Access,VB.6.0)

Date Validation Function (Microsoft® Access,VB.6.0)

Send Link

Questions

Currency Conv.
  Widget Info  
Date Validation function.

To use with Microsoft® Access, in the After_Update or Before_Update event of a TextBox enter.
=ValidateDate(!TextBoxName)

Public Function ValidateDate(ByVal thisDate As Variant) As Boolean
On Error GoTo errTrap
'Set the default return value to True
ValidateDate = True
'Check that a valid date was entered
If IsDate(thisDate) = False Then
MsgBox "Please enter a valid date!", vbOKOnly
ValidateDate = False
Exit Function
End If
'Check that the date entered is greater than today
If CDate(thisDate) <= Date Then
'MsgBox "Please enter a date greater than today!", vbOKOnly
ValidateDate = False
End If
'Check that the date entered is not out of range, entered incorrectly or too far into the future
If CDate(thisDate) > #1/1/2010# Then
MsgBox "Please check the date entered!", vbOKOnly, "Date Out Of Range"
ValidateDate = False
End If
'Enter other validation rules here.....
''''IE: disallow weekends

If Weekday(CDate(thisDate)) = 7 Or Weekday(CDate(thisDate)) = 1 Then
MsgBox "Weekends Not Premitted", vbOKOnly
ValidateDate = False
End If
Exit Function
errTrap:
MsgBox Err.Number & Err.Description
End Function

 Licensing
Format: HTML Article
Online Document
Licencing Terms: Developer Re-Use: Programming Experience Required
Project Development Use Only. Re-Distribution Permitted only as part of a compiled Application. This source code is provided to you "as is" without warranty.
CLICK HERE FOR TERMS OF USE
Copyright 2002-2006 Comrie Software Solutions
 Related Widgets

Age Function VB 6.0 Using DateDiff()
Alpha-Tabbed Address Book for Microsoft® Access
Alternate row colors on reports with Microsoft® Access
Change Conditional Formating in code (Microsoft® Access)
DateRange Calendar For Microsoft® Access
DateRange Class VB 6.0

ShoppingCart Empty
Services Contact Info Legal Info
Designated trademarks and brand names are the property of their respective owners.

By accessing this website it is assumed that you agree to the TERMS OF USE.

Send questions or comments regarding this website to  Comrie Software Solutions.

Click here for a complete list of available Widgets.