between datetime value from date time picker

S

Souris

SELECT 5 as MyID, ActivityDate, tblEmployee.FirstName as Employee,
WorkingHour as MyValue, "Working Hour" as MyCode from tblActivity
INNER JOIN tblEmployee on tblActivity.Employee_ID = tblEmployee.Employee_ID
WHERE ActivityDate between cdate([forms]![frmReport]![dtpStartdate]) and
cdate( [forms]![frmReport]![dtpEnddate])

I have above query.
The ActivityDate is datetime field and stores only date informaiton.
dtpStartDate and dtpEndDate are date time picker controls on the form.

I want to retrieve all data for Apr/17/2008 and select the date Apr/17/2008
in both date time picker.

It returns data for Apr/16 and Apr/17, but sometimes for Apr/17 only.
Does between clause inclusive and exclusive those selctions?
Does date time picker pass date time or date only to the query?
what is the best way to retrieve specific date from datetime fields using
date time picker value?
Are there any property to set to pass only date value, but not date time?

Your help is great appreciated,
 
S

Souris

Thanks millions,


Klatuu said:
Try CDate(ActivityDate - Timevalue(ActivityDate)) Between ....

--
Dave Hargis, Microsoft Access MVP


Souris said:
SELECT 5 as MyID, ActivityDate, tblEmployee.FirstName as Employee,
WorkingHour as MyValue, "Working Hour" as MyCode from tblActivity
INNER JOIN tblEmployee on tblActivity.Employee_ID = tblEmployee.Employee_ID
WHERE ActivityDate between cdate([forms]![frmReport]![dtpStartdate]) and
cdate( [forms]![frmReport]![dtpEnddate])

I have above query.
The ActivityDate is datetime field and stores only date informaiton.
dtpStartDate and dtpEndDate are date time picker controls on the form.

I want to retrieve all data for Apr/17/2008 and select the date Apr/17/2008
in both date time picker.

It returns data for Apr/16 and Apr/17, but sometimes for Apr/17 only.
Does between clause inclusive and exclusive those selctions?
Does date time picker pass date time or date only to the query?
what is the best way to retrieve specific date from datetime fields using
date time picker value?
Are there any property to set to pass only date value, but not date time?

Your help is great appreciated,
 
D

Dale Fye

???

Instead of subtracting the TimeValue, why not just use the DateValue( )
function:

WHERE DateValue([ActivityDate]) Between ....

Dale
--
Don''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.



Klatuu said:
Try CDate(ActivityDate - Timevalue(ActivityDate)) Between ....

--
Dave Hargis, Microsoft Access MVP


Souris said:
SELECT 5 as MyID, ActivityDate, tblEmployee.FirstName as Employee,
WorkingHour as MyValue, "Working Hour" as MyCode from tblActivity
INNER JOIN tblEmployee on tblActivity.Employee_ID = tblEmployee.Employee_ID
WHERE ActivityDate between cdate([forms]![frmReport]![dtpStartdate]) and
cdate( [forms]![frmReport]![dtpEnddate])

I have above query.
The ActivityDate is datetime field and stores only date informaiton.
dtpStartDate and dtpEndDate are date time picker controls on the form.

I want to retrieve all data for Apr/17/2008 and select the date Apr/17/2008
in both date time picker.

It returns data for Apr/16 and Apr/17, but sometimes for Apr/17 only.
Does between clause inclusive and exclusive those selctions?
Does date time picker pass date time or date only to the query?
what is the best way to retrieve specific date from datetime fields using
date time picker value?
Are there any property to set to pass only date value, but not date time?

Your help is great appreciated,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top