I know, I should have caught that sooner. This was actually a 3rd party app
I found at aspin. Used it to save time, didn't have enough to write one
from scratch. I've been tweakin it and problems like this keep coming up,
arg. It also came with the Date field including the Time which is a pain
because I'll have to go back and create a new field for time and rewrite all
the sql calls because it screws up searches, e.g. BETWEEN #DATE# AND #DATE#
if the time is greater than midnight....pain in the kee. So much for saving
time....
"Phill. W" <P.******@open.ac.uk> wrote in message
news:bh**********@yarrow.open.ac.uk...
"John K" <no***@amIgivingitouthere.com> wrote in message
news:hM*********************@twister.nyroc.rr.com. .. can anyone tell me what's wrong with this?
searchSQL = "Select * FROM Events WHERE Date >=#" & DateBegin & "# AND
Date <=#" & DateEnd & "# ORDER BY Date " & sort & ";"
John,
1). Don't use "Select *", it's downright inefficient,
2). Don't use "Date" as a column name; it's a reserved word
3). Investigate the SQL keyword "Between",
4). Make sure the dates you supply "make sense" to your database,
by which I mean /format/ your dates before adding them into the
SQL. Wherever I can, I use this format - "yyyy-mm-dd hh:nn:ss"
- just about everything can understand it without any ambiguity.
HTH,
Phill W.