Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to pass a date in Excel to ms query
"WHERE (`Shift/Day Report`.Date={ts '2004-04-01 00:00:00'})"
"WHERE (`Shift/Day Report`.Date={ts '" & Format(Range("A1"), _ "YYYY-MM-DD HH:MM:SS") & "'})" replace HH:MM:SS with 00:00:00 if you won't have a date value including time in A1 (only a date). -- Regards, Tom Ogilvy "Vince" wrote in message ... The following code works fine, but I need the date referenced in the query to update automatically with the date that is located in Cell A1 of the spreadsheet. I would appreciate any help given. Vince -------------------------------------------------------------------------- -------------- With Selection.QueryTable .Connection = Array(Array( _ "ODBC;DSN=MS Access Database;DBQ=C:\ABBTemp\STK5.MDB;DefaultDir=C:\ABB Temp;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5" _ ), Array(";")) .CommandText = Array( _ "SELECT `Shift/Day Report`.Date, `Shift/Day Report`.`PRODUCTION TONS_DAY`" & Chr(13) & "" & Chr(10) & "FROM `C:\ABBTemp\STK5`.`Shift/Day Report` `Shift/Day Report`" & Chr(13) & "" & Chr(10) & "WHERE (`Shift/Day Report`.Date={ts '2004-04-01 00:00:00'})" & Chr(13) & "" & Chr(10) & "O" _ , "RDER BY `Shift/Day Report`.Date") .Refresh BackgroundQuery:=False End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
pass parameter to access query | Links and Linking in Excel | |||
Pass date parameter into MS Query | Excel Discussion (Misc queries) | |||
Is it possible to pass a parameter into IN operator in Query? | Excel Discussion (Misc queries) | |||
Pass Parameter to Access Query | Excel Programming | |||
Pass a filename to a query | Excel Programming |