LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How refer to current date in Excel SQL query?

May just be the position/use of your parenthesis.. I tried the
following clause in MS Access and then in the MS Query window and both
gave me the same result..

WHERE ((TblTraffic.RPT_DATE)<Now())

HTH,
Will


Ronald S. Cook wrote:
But what I'm writing is write in the SQL query window so I can't establish
variables, etc.

I tried the below but it didn't work either:

SELECT e.EVENTNAME, e.EVENTDATE
FROM EVENT e
WHERE (e.EVENTDATE = DateValue(Now())
ORDER BY e.EVENTDATE



wrote in message
ups.com...
Ronald, Here is the way I handle the Date issue..

strToday = DateValue(Now())

SQL = Select * from MyTable where DateField < strToday



Ronald S. Cook wrote:
I'm trying to use Microsoft Query within Excel to write a SQL query
against
a data set.

SELECT e.EVENTNAME, e.EVENTDATE
FROM EVENT e
WHERE (e.EVENTDATE = DATE()
ORDER BY e.EVENTDATE

In the above, DATE() is not correct to get the current system date. I
tried
DATE, NOW, NOW(), GETDATE, GETDATE(), TODAY, TODAY().. now of which
worked.

Can someoine please tell me the correct syntax?

Thanks!
Ron



 
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
MS Query - Filtering all dates greater than the current date BridgeBuilder Excel Discussion (Misc queries) 1 March 26th 10 08:58 PM
Trying to pull the data for current date - Query Viol-8-r New Users to Excel 1 September 11th 09 01:49 AM
Refer to current row in formula willemeulen[_12_] Excel Worksheet Functions 5 May 19th 09 03:34 PM
How do I enter a date range ie -7 from current date in MS QUERY notsmartenough Excel Discussion (Misc queries) 1 November 11th 05 10:17 PM
how to I refer to current workbook without using its name? confused Excel Worksheet Functions 2 June 16th 05 11:50 PM


All times are GMT +1. The time now is 09:08 AM.

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

About Us

"It's about Microsoft Excel"