Re: TADOQuery and Date fields problem



I see that you are using the variable "serviceDate" to set the value
of this parameter. Where is this variable being initialised ?

Would seem that the error is being generated because the variable has
no value when you define the parameter.



Paul.


On Thu, 16 Jun 2005 10:48:17 -0400, "Shannon Walker"
<shannon.walker@xxxxxxxxxx> wrote:

>I tried the following:
>
> with qryLookUp.Parameters.AddParameter do begin
> DataType := ftDateTime;
> Direction := pdInput;
> Name := 'SERVICE_DATE';
> Value := serviceDate;
> end;
> qryLookUp.SQL.Add('SELECT * FROM ConcentratorRecords WHERE ((DevID = '+
>IntToStr(intDevID) + ') and (ServiceDateTime = '+
>qryLookUp.Parameters[0].Name + '))');
>
>But now when the query is run it says SERVICE_DATE doesn't have a default
>value.
>
>I am not sure what I am doing wrong.
>
>"Opp" <nospam@xxxxxxxxxxxxxxx> wrote in message
>news:9av2b1t3980ai8amnk3hb3r1lervqjjhj9@xxxxxxxxxx
>> Here is a (brief) example of what that may look like..
>>
>> Here - IQ is the name of your ADO Query component..
>>
>>
>> with IQ.Parameters.AddParameter do begin
>> DataType := ftDateTime;
>> Direction := pdInput;
>> Name := 'ServiceDaeTime';
>> Value := Date;
>> end;
>>
>>
>> Not Sure if setting the value in this way is correct - but you could
>> try it.
>>
>> Paul.
>>
>>
>>
>>
>> On Thu, 16 Jun 2005 08:24:58 -0400, "Shannon Walker"
>> <shannon.walker@xxxxxxxxxx> wrote:
>>
>> >If I want to make my dateTime value a parameter in my query, what would
>that
>> >look like?
>> >
>> >
>> >"Brian Bushay TeamB" <BBushay@xxxxxxxxx> wrote in message
>> >news:ckn1b11k514rq2a4vutkvnujspv431e8a9@xxxxxxxxxx
>> >> >I am using a TADOQuery in order to search through a table of records
>for
>> >a
>> >> >date value. I can't seem to get the syntax right when specifying the
>SQL
>> >> >statement though. I have the following:
>> >> >
>> >> > qryLookUp.SQL.Add('SELECT * FROM table1 WHERE ((DevID = '+
>> >> >IntToStr(intDevID) + ') and (ServiceDateTime = #' + serviceDate + '#'
>> >> >+'))');
>> >> >
>> >> >serviceDate above is a string containing the date and time I am
>looking
>> >for.
>> >> >ServiceDateTime DateTime field in MS Access.
>> >> >
>> >> >I get an error that says 'Parameter object is improperly defined'.
>Does
>> >> >anyone know the syntax for doing a search for a date value?
>> >>
>> >> Use a parameter in your query for the dateTimeValue
>> >> Then set the value of the parameter.
>> >> Or format you Time value to use "." instead of ":" as the separator and
>> >drop the
>> >> "#" characters just quote the dateTimevalue
>> >>
>> >>
>> >>
>> >> --
>> >> Brian Bushay (TeamB)
>> >> Bbushay@xxxxxxxxx
>> >
>>
>

.



Relevant Pages

  • RE: Creating query to produce report
    ... "Paul" wrote: ... > able to print this info in a report and i presume creating a query would be ... > it can reference the Variable IDs and give the text description rather than ... > I also have trouble with Access telling me changes or deletions cant be done ...
    (microsoft.public.access.queries)
  • Re: From Date x to Date y (Query table data)
    ... > Criteria of the date field in the query, ... The query we are creating will pull data ... and several queries for all the different time frames. ...
    (microsoft.public.access.queries)
  • RE: Top 10 Percent / Top 10 Values
    ... Yes use your table name instead of Paul. ... If I create a new query would I need to write this code in a SQL view of the ... "KARL DEWEY" wrote: ... I have already worked out how many records there are per client, ...
    (microsoft.public.access.queries)
  • Re: Periodic Time Triggering!
    ... > and the one suggested by Paul G. Tobey. ... > problem of meeting deadline (i.e. the frequency for each kind of query). ... >> and have each act as the timer func for its own timer. ...
    (microsoft.public.windowsce.app.development)
  • Re: Periodic Time Triggering!
    ... > and the one suggested by Paul G. Tobey. ... > problem of meeting deadline (i.e. the frequency for each kind of query). ... >> and have each act as the timer func for its own timer. ...
    (microsoft.public.pocketpc.developer)