473,382 Members | 1,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Now() not working in SQL query - syntax error

In an ASP file using vbscript and JET 4.0:
In the Access2000 database the date_added field is set as general date.

Why does
"SELECT * FROM traffic_log WHERE date_added >= " & DateAdd("h",-24,Now()) produces a syntax error

and

"SELECT * FROM traffic_log WHERE date_added >= " & DateAdd("h",-24,Date()) works fine ??

I need to retreive records added in the last 24hrs.

In Access2000 both produce NO errors?? I only get this problem in vbscript??
Mar 5 '08 #1
1 1608
shweta123
692 Expert 512MB
Hi,

You can try CDate function to use with Now() function.

SELECT * FROM traffic_log WHERE date_added >= " & DateAdd("h",-24,Cdate(Now()))

In an ASP file using vbscript and JET 4.0:
In the Access2000 database the date_added field is set as general date.

Why does
"SELECT * FROM traffic_log WHERE date_added >= " & DateAdd("h",-24,Now()) produces a syntax error

and

"SELECT * FROM traffic_log WHERE date_added >= " & DateAdd("h",-24,Date()) works fine ??

I need to retreive records added in the last 24hrs.

In Access2000 both produce NO errors?? I only get this problem in vbscript??
Mar 6 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: joemyre | last post by:
Hi everyone, What I'm trying to do is take php variables i got from user input, and pass them as the MySQL query terms. $query = "select * from ident where ".$searchtype1."=".$searchterm1."";...
10
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. ...
3
by: Alex | last post by:
Hi folks, Hopefully this is a simple fix, but I keep getting Syntax error with this statement in an MS SQL DTS statement and in Query Analyzer: Update A Set A.deptcode = A.deptcode, A.type =...
1
by: cnliou | last post by:
Hi! If I correctly understand v7.4 manual, value, say, '2003-11-26 12:00' in TIMESTAMP WITHOUT TIMEZONE column should output '2003-11-26 19:00' for "+08:00" timezone. The following test...
4
by: spam | last post by:
If I run the following query in Access 2002 then I get the expected result: SELECT * FROM CSVImport UNION SELECT * FROM AssetTemp; I get the contents of both tables with no duplicates. If I...
2
by: salvadorvp | last post by:
Hi, I wonder If somebody has experience this or could point me in the right direction: I have the following script (commented out just to use the username): // Check username and password //...
2
by: stmfc | last post by:
i have a problem with user creation for mysql db i think the problem stems from string style. GRANT ALL ON newDB.* TO 'test'@'localhost' IDENTIFIED BY 'test'; i am...
0
bartonc
by: bartonc | last post by:
This is a work in progress (current and active). There are some issues to resolve in supporting multiple connection types and I plan to add PySQLite to the mix. The this update is due to my...
22
by: MLH | last post by:
100 Dim db As Database, rst As Recordset 120 Set db = CurrentDb 140 PString = "SELECT qryBatchList.ReadyFor906, qryBatchList.BatchID FROM qryBatchList WHERE...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.