Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Validation.. 1

Status
Not open for further replies.

thetambarineman

Technical User
Feb 29, 2000
63
GB
Can anyone suggest a way to validate a date entered into an access database??? i.e. if someone enters a string or incorrectly formatted date- it reconverts it to the proper format (i.e. dd/mm/yyyy)

Also could someone advise me as to the SQL statement required for a partial match search - i.e. search for Micro
and the database brings up Microsoft etc..

Thanks in advance for any help...

Paul..
 
You can use the IsDate() function to text whether a string contains a correctly formatted date, provided you don't care which particular format was entered (i.e. "12/02/2001" or "February 2, 2001" are both valid). If you're storing the date in a Date variable or DateTime field, it will be converted automatically.

If your partial match is always on a prefix of the string, the SQL WHERE clause can contain "WHERE FieldName LIKE 'Micro*'". If you want to allow embedded substrings to be found, use "LIKE '*Micro*'". Rick Sprague
 
Try to use the DateTimePicker control. This will force the user to enter the date in a pre-determined date format.

This way you don't have to do any date validations, the control will take care of it.

- Subha :) Nothing is impossible, even the word impossible says I'm possible.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top