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 / November 2005

Tip: Looking for answers? Try searching our database.

Dcount Date time field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mike - 14 Nov 2005 15:25 GMT
Hi All, I am trying to create a counter based on the date and time entered
in a field.  I looked up Dcount ideas in this newsgroup but it isn't
working.  Here's my SQL

SELECT ZipMiles4.ShipperApptDate, ZipMiles4.ShipperApptTime,
ZipMiles4.LocationZIP, ZipMiles4.ID, ZipMiles4.Sort,
[ShipperApptDate]+nz([ShipperApptTime]) AS DT, DCount("DT","ZipMiles5","DT
<=" & [DT]) AS Ord
FROM ZipMiles4;

The Ord field returns #error.  It is a Date/Time field.  Please help.

Thanks,
Mike
Mike - 14 Nov 2005 15:54 GMT
I figured it out.  I needed "'"&[DT]&"'" on the end.

> Hi All, I am trying to create a counter based on the date and time entered
> in a field.  I looked up Dcount ideas in this newsgroup but it isn't
[quoted text clipped - 10 lines]
> Thanks,
> Mike
John Vinson - 14 Nov 2005 20:43 GMT
>I figured it out.  I needed "'"&[DT]&"'" on the end.

That will work but it's doing it the hard way - converting the
date/time to a string and then doing a string comparison. The string
comparison will give you incorrect results - the text string
"9/15/2005" is GREATER than the text string "11/4/2005".

Try  DCount("DT","ZipMiles5","DT <= #" & [DT] & "#")

The # character is a date delimiter.

                 John W. Vinson[MVP]    
 
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



©2008 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.