Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

between datetime value from date time picker

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Souris - 18 Apr 2008 14:42 GMT
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,
Klatuu - 18 Apr 2008 15:53 GMT
Try CDate(ActivityDate - Timevalue(ActivityDate)) Between ....

Signature

Dave Hargis, Microsoft Access MVP

> SELECT 5 as MyID, ActivityDate,  tblEmployee.FirstName as Employee,
> WorkingHour as MyValue, "Working Hour" as MyCode from tblActivity
[quoted text clipped - 17 lines]
>
> Your help is great appreciated,
Souris - 18 Apr 2008 16:02 GMT
Thanks millions,

> Try CDate(ActivityDate - Timevalue(ActivityDate)) Between ....
>
[quoted text clipped - 19 lines]
> >
> > Your help is great appreciated,
Dale Fye - 18 Apr 2008 17:23 GMT
???

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

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

Dale
Signature

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

email address is invalid
Please reply to newsgroup only.

> Try CDate(ActivityDate - Timevalue(ActivityDate)) Between ....
>
[quoted text clipped - 19 lines]
> >
> > Your help is great appreciated,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.