Re: ADO - Access and TDate parameter
From: A Nonymous (a.nonymous_at_the.net)
Date: 09/19/04
- Next message: Brian Bushay TeamB: "Re: Zombie state error:abort Message"
- Previous message: George Kvasha: "DBGrid Selected Rows"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 19 Sep 2004 23:51:05 +0200
Don't know where you live but SQL *insists* on US date format:
#04/01/2004# means April 1, 2004
google around for a VBA function MakeUSdate in some MSAccess groups. Some
offer explanation.
HTH
"David M" <borlandnewsWITHNO@SPAMmoorhouse.net.nz> wrote in message
news:ednmf0tds3pfta9u499fstofqtfsjb3uai@4ax.com...
> Thanks for your help, but
>
> the only way I can get this to work is by embedding the date values
> into the SQL text.
>
> Regards
>
> David M
>
>
> On Mon, 5 Jul 2004 16:46:25 +0100, "Ana Alberts"
> <ana_alberts@hotmail.com> wrote:
>
> >I always explicitly declare the type of parameter when it comes to
dates...
> >and it seems to work fine.
> >
> >cmdManager.Parameters.Items[0].DataType := ftDateTime;
> >cmdManager.Parameters.ParamByName('param1').Value := dtpkTXN.date;
> >
> >Hope this helps.
> >Ana
> >
> >"David M" <borlandnewsWITHNO@SPAMmoorhouse.net.nz> wrote in message
> >news:9115e0doukmfpcoa2r5v281hsp61rujlu0@4ax.com...
> >> Hi,
> >>
> >> I have a MS Access 2000 database connected via TADOQuery in D7Ent
> >> running under Win XP Pro.
> >>
> >> My query fetches data from two tables including a nested SELECT as
> >> below ...
> >>
> >> with ADOQuery1 do begin
> >> Close;
> >> SQL.Clear;
> >> Parameters.Clear;
> >> SQL.Add('SELECT DISTINCT IH.InterventionID');
> >> SQL.Add('FROM InterventionHeaders AS IH INNER JOIN
> >> InterventionDetails AS ID ON IH.InterventionID = ID.InterventionID');
> >> SQL.Add('WHERE (ID.Quarter >= :StartDate1) AND (ID.Quarter <=
> >> :EndDate)');
> >> SQL.Add('AND NOT(IH.InterventionID IN (');
> >> SQL.Add('SELECT ID2.InterventionID FROM InterventionDetails
> >> ID2');
> >> SQL.Add('WHERE (ID2.Quarter <= :StartDate2)))');
> >> Open;
> >> end;
> >>
> >> Now here's the weird bit. If I hard code the parameters using the
> >> #mm/dd/yyy# format it works as expected.
> >>
> >> If I use the SQL as above and set params before opening as ...
> >> Parameters.ParamByName('startdate1').Value := EncodeDate(yyyy, mm,
> >> dd);
> >> ... then I get an empty result set back.
> >>
> >> Is this an ADO thing as I've run out of other ideas.
> >>
> >> Any suggestions will be appreciated.
> >>
> >> David M
> >>
> >
>
- Next message: Brian Bushay TeamB: "Re: Zombie state error:abort Message"
- Previous message: George Kvasha: "DBGrid Selected Rows"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|