Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default datetime in query

How can I replace {ts '1990-12-31 00:00:00'} in the query
macro with any time I want? For example, I defined a
string called LastTime, and set LastTime = "2003-07-23
00:00:00". But {ts 'LastTime'} will not work.

{ts '1990-12-31 00:00:00'} is ANSI standard datetime format

Here are few lines from my macro:

With Selection.QueryTable
..Connection = _
"ODBC;DRIVER=
{MicrosoftODBCforOracle};UID=ICL;PWD=USER;SERVER=V GSM;"
..CommandText = Array( _
"SELECT SAMPLE_ACTIVE.LOGIN_DATE" & Chr(10) & "FROM
VGSM.SAMPLE_ACTIVE SAMPLE_ACTIVE" _
& Chr(10) _
& "WHERE (SAMPLE_ACTIVE.LOGIN_DATE{ts '1990-12-31
00:00:00'})")
..Refresh
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default datetime in query

Ling

....{ts '" & LastTime & "'}...

The SQL statement inside the array is just a string, so you can concatenate
with the ampersand.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Ling" wrote in message
...
How can I replace {ts '1990-12-31 00:00:00'} in the query
macro with any time I want? For example, I defined a
string called LastTime, and set LastTime = "2003-07-23
00:00:00". But {ts 'LastTime'} will not work.

{ts '1990-12-31 00:00:00'} is ANSI standard datetime format

Here are few lines from my macro:

With Selection.QueryTable
.Connection = _
"ODBC;DRIVER=
{MicrosoftODBCforOracle};UID=ICL;PWD=USER;SERVER=V GSM;"
.CommandText = Array( _
"SELECT SAMPLE_ACTIVE.LOGIN_DATE" & Chr(10) & "FROM
VGSM.SAMPLE_ACTIVE SAMPLE_ACTIVE" _
& Chr(10) _
& "WHERE (SAMPLE_ACTIVE.LOGIN_DATE{ts '1990-12-31
00:00:00'})")
.Refresh
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
Datetime CSV format kh[_2_] Excel Discussion (Misc queries) 1 November 13th 08 09:08 AM
Remove Time from DateTime [email protected] Excel Discussion (Misc queries) 5 September 18th 08 08:57 PM
pop up calendar using MS DateTime Picker andy62 Excel Worksheet Functions 4 June 19th 07 10:18 PM
MS Query DateTime String Dean Excel Worksheet Functions 1 January 23rd 06 12:07 PM
autodate and datetime stamp DC Gringo Excel Worksheet Functions 1 December 3rd 04 06:25 PM


All times are GMT +1. The time now is 01:42 AM.

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"