Date Format between Informix, Access 95 and ODBC drive
Posted in 1997
Topics: Connectivity: ODBC / JDBC / .NET
We are using Access 95 with 32bit ODBC drive from Intersolv to access the Informix on-line 5.07 database server to generate some reports. When we passed the parameter from Access to look up the value in the Informix table, for the certain date, it generated error (Run time error, ODBC call failed), We believe it is the date format which Access defined and passed to Informix, but Informix did not agree. The date format set up in the Informix table is dd.mm.yyyy (13.06.1997), the date in the Access defined is dd/mm/yy , When pass this date format without adding the no_of_days (another variable which is the integer) to the date, it works fine, but when I added the no_of_days to the date then pass the new date, it always gives you error if the dd greater then 13. (13/06/97, 14/06/97,15/06/97 will have error, but 12/06/97,11/06/97 are fine). Does anyone have same problem before? You help in this matter is very much appreciated. I copy some of the code from access, hope it helps to explain this problem. Function SupplyRateOdbc(SupplyId, CurrentCode, PriceCategory, PriceType, PriceCatalog, RateDate As Date, NoDay As Integer) As Variant Dim IntervalType As String Dim NumberDay As Integer IntervalType = "d" NumberDay = NoDay - 1 RateDate = DateValue(DateAdd(IntervalType, NumberDay, RateDate)) RateDate = Format(RateDate, "dd/mm/yy") ' RateDate = CDate(RateDate) SupplyRateOdbc = NullToZero(DLookup("[sr_amount]", "supply_price", "[sp_id] = " & SupplyId & " AND [cu_ccy_code]= '" & CurrentCode & "' AND [pc_category]= '" & PriceCategory & "' AND [pr_price_type]= '" & PriceType & "' And [sr_is_catalog]= '" & PriceCatalog & "' And [sr_start_date] <= #" & RateDate & "# AND [sr_end_date] >= #" & RateDate & "#")) End Function