Patrick Wrote :-
> I discovered that using a range of only one day, records with the date of
> that day were not selected but if the range was extended a day in one
> direction, then records would be selected.
Yes I have discovered this before myself.
It SEEMS to be something that spans Most products and Db's.
I first spotted this in Delphi, but have also noticed it in Vb at work.
I basically don't use TParams but build the SQL in code, and add the params
as needed.
I.e. 'WHERE NAME = "'+fName+'" And '.......
with Dates, I check to see if the dates selected are the same and used to do
this :-
if fDateFrom = fDateTo then
SQL:='WHERE Date = #'+fDateTo+'#'
else
SQL:='WHERE date between #'+fDateFrom+'#' AND #'+fDateto+'#'
Or atleast some thing like this from memory.
BUT, from what I have found, basically if you use DATETIME fields in a
database, it stores the TIME as well as the DATE....so I have now started
using the BETWEEN syntax and appending 00:00:00 to the From date , and
23:59:59 to the TO date.
I have found this to be the pref. way as it spans a day OVER a literal day.
i.e.
if fDateFrom = fDateTo then
begin
fdateFrom:= StrToDate(DateToStr(fDateFrom)+' 00:00:00'));
fdateTo:= StrToDate(DateToStr(fDateTo)+' 23:59:59'));
end;
SQL:='WHERE date between #'+fDateFrom+'#' AND #'+fDateto+'#'
(I didn't test this but it will give the idea atleast)
Well thats my findings anyway...and away I found to solve the problem.hope
it helps.
Cheers, Jeremy Coulter
---------------------------------------------------------------------------
New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz