PDA

Click to See Complete Forum and Search --> : What's wrong with Oracle date?


Feb 17th, 2000, 02:47 PM
Please the code below:
date1 = Format(Text1.Text, "dd/mmm/yy")
date2 = Format(Text2.Text, "dd/mmm/yy")
rs.Source = "select * from SaleHead where shcustno = '" & Combo1.Text & "' and OrderDate >= '" & date1 & "' AND OrderDate <= '" & date2 & "'"
Set rs.ActiveConnection = cn
rs.Open
:-------------------------------------------:
Please see the date1 to date2 statement
I've also tried #" & date1 & "#. It dosen't work at all.

Please

-Khamal-

JohnAtWork
Feb 18th, 2000, 12:33 AM
In addition, Oracle always Date/Time stamps.

You will probably have to use the TO_CHAR function to massage the date to what you want.

TO_CHAR(Orderdate, 'DD-MON-YYYY')

Also, I would double check the dates that you are using as variables. . . are you declaring them as dates or as strings?
I would run Date1 = CDate(Text1.Text) in order to make sure you're passing Dates along instead of strings.

Feb 18th, 2000, 04:48 AM
Both work, Thank you....

-Khamal-
:D

Marita_l
Feb 18th, 2000, 11:57 AM
I found this at an ORACLE SQL reference site this is the correct format for an ORACLE date. ORACLE uses - not \.

DATE datatype
A standard Oracle datatype used to store date and time data. Standard date format is DD-MMM-YY, as in 01-JAN-89. A DATE column may contain a date and time between January 1, 4712 BC to December 31, 4712 AD.

Try this maybe it will work. Otherwise you may have to TO_DATE the field as it is passed to ORACLE this will slow down the system though as it by passes all indexes.