Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pass parameter to access query Bill Manville Links and Linking in Excel 4 May 1st 23 03:45 AM
Pass date parameter into MS Query Richard Edwards Excel Discussion (Misc queries) 2 June 20th 08 11:43 AM
Is it possible to pass a parameter into IN operator in Query? DennisS Excel Discussion (Misc queries) 0 June 26th 07 09:27 AM
Pass Parameter to Access Query Al Excel Programming 3 April 29th 04 10:15 AM
Pass a filename to a query Mike Fogleman Excel Programming 1 December 25th 03 10:26 PM


All times are GMT +1. The time now is 12:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"