Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi,
I'm trying to import data from a MS SQL 2005 server. But I'm having trouble with datetime: When I give the date hardcoded (e.g. 2007-11-10) for "MyDate" in the query it works fine. Stepping true code below gives the value "#10-11-2007#" for MyDate. Even after giving it a new NumberFormat This is what I got sofar: Dim MyDate Range("A1").Select Selection.NumberFormat = "yyyy/mm/dd" MyDate = ActiveCell With ActiveSheet.QueryTables.Add(Connection:= _ "ODBC;DSN=XXXX;UID=Productie;PWD=XXXXX;APP=Test;WS ID=;DATABASE=XXXX" _ , Destination:=Range("A2")) .CommandText = Array( _ "SELECT O.OrderId, O.DeliveryDate, O.SACity, FROM Orders O WHERE (O.DeliveryDate'MyDate') ) Any idee would be great, Giel |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
find a character in a string | Excel Discussion (Misc queries) | |||
Excel-Match 1st text character in a string to a known character? | Excel Worksheet Functions | |||
MS Query DateTime String | Excel Worksheet Functions | |||
Splitting Character String | Excel Worksheet Functions | |||
Find nth instance of a character in a string | Excel Discussion (Misc queries) |