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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ordering by date

Status
Not open for further replies.

bongmarley

Programmer
Joined
Oct 21, 2002
Messages
74
Location
CA
I am trying to order people from a database based on their date of birth.

so the code is like this

("select * from tablename order by birthdate")

However the birthdate field is of type text so i have to use the cdate() function. This works good however the field is not required so it can contain a Null value. The cdate() function can not be used on a Null value. It just gives me an error. Is there any way to get around this
 
Yes, change the datatype of your column to datetime!! Is there any reason it was not set up like this?

You could work round it but it will be much easier if you can change the type. --James
 
Changing the datatype is not an option based on a lot of factors.
 
What DB are you using and what format are the char dates in, eg dd/mm/yyyy? --James
 
you dont have to do so much
if DtValueFromDb<>&quot;&quot; then
cdate(DtValueFromDb)...
end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top