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 / May 2006

Tip: Looking for answers? Try searching our database.

dates as query criteria

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Doug F. - 30 May 2006 04:09 GMT
On the query grid for a date field I can hardcode #5/7/2006# but find that
using #may/7/2006# is more reliable as it's specific and unambiguous, ie is
it May 7 or July 5 that I want.  Does the local machine setting do the
determination when using the #5/7/2006# format?  Is my #may/7/2006# solution
commonly used?

Also, I believe that I must use the #...# to indicate a date, true?  When I
use the between [date1] and [date2] construct as a user prompt must I use ##
somehow?
Thanks.
Signature

Doug F.

Allen Browne - 30 May 2006 04:23 GMT
The # delimiter is correct for literal dates within the SQL statement (and
in VBA also.)

When adding paramters to a query, do not add the # to the parameter name.

Internally, Access actually stores dates as real numbers, where the integer
part represents the date and the fraction part the time. You can see this
for yourself if you open the Immediate window (Ctrl+G) and enter:
   ? CDbl(Now())

Using text (e.g. may) inside the # is not correct.

For details on how Access interprets date entries, see:
   International Date Formats in Access
at:
   http://allenbrowne.com/ser-36.html

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> On the query grid for a date field I can hardcode #5/7/2006# but find that
> using #may/7/2006# is more reliable as it's specific and unambiguous, ie
[quoted text clipped - 10 lines]
> somehow?
> Thanks.
Rob G - 30 May 2006 15:57 GMT
Great post Allen.  I went to your website and you helped me resolve a real
nagging date problem that I had in my where clause.  SQLDate did the trick.

> The # delimiter is correct for literal dates within the SQL statement (and
> in VBA also.)
[quoted text clipped - 27 lines]
> > somehow?
> > Thanks.
Doug F. - 30 May 2006 17:18 GMT
Thanks muchly.
Signature

Doug F.

> The # delimiter is correct for literal dates within the SQL statement (and
> in VBA also.)
[quoted text clipped - 27 lines]
> > somehow?
> > Thanks.
 
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.