Click to See Complete Forum and Search --> : Y2K


January 15th, 2000, 03:23 PM
I have a field for Order Detail Number wich has the format YYMM-OOOO-X-XX where YY are last digits of year, MM is month, OOOO - Order Number, X - Type of Order, XX - Number of Detail. By Y2K I could use ORDER BY OrderDetailNumber DESC to display records in appropriate order. Now it doesn't work anymore. Any ideas how to sort this kind of data to display records in descending order ?
I have OrderDetailID (auto increment), but I cannot use it because Order Details might be entered for old order, so they will not be groupped by order.
Thank you
Vlad

January 17th, 2000, 11:04 AM
As you are only using two digits for your year you can only have a reference to 100 different years.
Try the following code;

IF yy<50 THEN yy=yy+2000
IF yy< 0 THEN yy=yy+1900

This will convert any number from 0 - 49 to 2000 - 2049
and 50 - 99 to 1950 - 1999
You can have a higher or lower number than 50, eg. IF yy<60 = 1960 - 1059
but your program will still only hold 100 years.

Hope this helps; MarkAgius@Aol.Com

January 17th, 2000, 11:26 AM
Thank you. But I do not sort by date.
I found the tricky way to sort my strings. I'm creating in a recordset an additional field wich has 0 or 1 in front of my string depending on what are first 2 characters. If CInt returns less than 50 I'm adding 1, if more then 0. After that I'm sorting by this field.
Vlad