May 24th, 2004, 06:07 AM
|
|
Date criteria syntax - Still need help
Thank you! Your help is greatly appreciated.
Ginger
-----Original Message-----
On Sun, 23 May 2004 20:04:04 -0700, "Ginger"
wrote:
Still got an error.
Extra ) in query expression '((qryBillingSummary.Date)
Between DateAdd('d',-5,Now()) and Now()))'.
The trick I use to count parentheses is to mentally go
through the
string, adding one for each ( and subtracting 1 for each
). Access's
habit of adding lots of uneeded extra parens makes this a
more tedious
exercise!
The expression you have quoted appears to have an extra )
since it
comes out to -1. Just remove the last ). Putting each
parenthetical
block on a separate line you can see why:
(
(qryBillingSummary.Date
)
BETWEEN DateAdd(
'd', -5, Now()
)
AND Now()
)
Note that: Date is a reserved word and is a bad choice of
fieldnames;
I'd suggest either changing the fieldname to BillingDate or
consistantly using square brackets. Also, Now() is NOT
today's date;
it'e the current date and time accurate to a few
microseconds. If you
want billing records between 11:31:14 am five days ago and
11:31:14
today, the syntax above will work; if you want the past
five days, I'd
suggest using Date() in place of Now().
John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
.
|