Solved

Access database and date errors

Posted on 2004-09-15
8
161 Views
Last Modified: 2010-05-02
I have an access database where my application stores dates in the dutch notation:

dd-mm-yyyy

but when i run aq sql query with between 01-07-2004 and 01-08-2004 it returns nothing, when i enter these dates: 07-01-2004 and 08-01-2004 it works fine.

But somehow not when i do this in my application.
0
Comment
Question by:markyvt
8 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
Comment Utility
Your dates are not stored in Dutch notation, they are displayed like that.
You have to specify get the correct date into the SQL. The easiest way to do that is #07/01/2004#. This notation only takes the American fomat.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
Comment Utility
It is VERY importatn to understand how date values are actuyally stored in the database.  They are NOT stored as "mm-dd-yyyy" or as "dd-mm-yyyy" or even asn "yyyy-dd-mm".

Rather, Date type values are stored internally as  Numbers (of type DOUBLE), which have a Decimal point.  The integer part of the number (to the LEFT of the decimal point) is the NUMBER of days since Dec 30, 1899.  The fractional part (to the right of the decimal pont) holds the TIME of day as measured in seconds since midnight, as a fraction of 1 day (1 day = 86400 seconds)

so right now (Sept 15, 2004 at 9:16:46 AM Eastern Daylight Time) the value of the number would be:

38245.3866551

that means that Sept 15, 2004 is 38245 days since dec 30, 1899

and 9:16:46 AM is .386651  of 1 day( = 33406 seconds since midnight)

How the data is DISPLAYED is up to you, and by default, Access uses US formatting.

AW
0
 
LVL 4

Expert Comment

by:hamood
Comment Utility
use query like this


select * from [Sample Table] where record_date between #1/1/2000# and #1/1/2001#

hamood
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Author Comment

by:markyvt
Comment Utility
when i use #1/1/2004# till: #8/1/2004# it does 1 jan untill 8 jan and not 1 jan until 1 august.

How can i solve this ?
0
 
LVL 2

Author Comment

by:markyvt
Comment Utility
Well the question is just half answered i still have this issue:

--
when i use #1/1/2004# till: #8/1/2004# it does 1 jan untill 8 jan and not 1 jan until 1 august.

How can i solve this ?
--
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 500 total points
Comment Utility
try this:

DateSerial(2004,1,1) tilL: DateSerial(2004,8,1)


it sounds like you have your regional settings set as DD/MM/YYYY (European) and you expect them to be MM/DD/YYYY (American)

AW
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Convert Excel Column Headers to Rows 8 81
Problem to delete range 4 54
Problem to the message 13 62
vb6 connector to SQL Server 2 32
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now