Use the DateAdd function in your where clause
WHERE li_date_time > DateAdd("s",-120, Now())
Since we don't know how you are populating li_date_time , it is hard to
advise you why the time is not showing.
If you are using the Date() function that only gives the system date (time
as midnight). IF you use Now() that gives both date and time.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
"Rick Brandt" <(E-Mail Removed)> wrote in message
news:XSBCh.26008$(E-Mail Removed)...
> Kahuna wrote:
>> Hi Folks
>>
>> This seems like it should be simple - so perhaps I have my STOOPID
>> head on today or something!
>>
>> I am writing a login app and I need to record the date AND time the
>> user logged in. Sounds simple enough:
>>
>> tblLoggedIn![li_date_time] (General Date Format)
>>
>> In the table view the record shows only the date - but no time?
>>
>> My target is to use a form with something like the following:
>>
>> ..."Where DatePart("n",[li_date_time]) > DatePart("n",Now())-2"
>>
>> Saying: where the last logged in time was longer than 2 mins ago!
>>
>> Even just using DatePart("n",[li_date_time]) simply results in an
>> ambiguous number.
>>
>> Have I got this completely wrong? How do I set the field to reference
>> both date and time together?
>>
>> Help appreciated.
>
> You don't say how you are populating the field. Are you setting it in
> code using the Now() function? Is the user entering the value manually?
> If the latter are they entering a time? Entering a date only will not
> default to the current time. It will default to midnight which (by
> default) Access does not display.
>
> --
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt at Hunter dot com
>
|