Results 1 to 4 of 4

Thread: What's wrong with Oracle date?

  1. #1
    Guest

    Post

    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-

  2. #2
    Lively Member
    Join Date
    Jul 1999
    Posts
    78

    Post

    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.

  3. #3
    Guest

    Post

    Both work, Thank you....

    -Khamal-


  4. #4
    Junior Member
    Join Date
    Feb 2000
    Posts
    19

    Post

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width