Hi,
I am developing a project in which I am checking for records with
overlapping start/end dates. Record dates must not overlap date of birth,
date of death, be in the future, and must not overlap existing records from
the same table.
I had this all working some time ago, but recently when I have gone back to
do more testing, part of these validations no longer work. While there have
been changes to the code in the meantime, I cannot see any changes that
could account for the current problem.
I am working with Access 2003 in WinXP, and the regional date format is set
to International format DD/MM/YYYY. I am pretty sure that the problem
involves the latter date format and that if my PC was using American format
there would not be a problem.
To specifics -- the following dates are date fields in the form:
Me!DOB (date of birth)
Me!DOD (date of death -- set to 31/12/9999 if still alive)
Me!StartDate (new record start date -- bound to the table)
Me!EndDate (new record end date -- bound to the table)
The table has the following date fields (in short date format):
StartDate
EndDate
Validations against DOB, DOD and TODAY (future date check) still work fine.
To check for overlapping of existing records, I use an SQL query with the
following WHERE clause for Me!StartDate check (similar SQL for Me!EndDate
check):
WHERE StartDate < #" & Me!StartDate & _
"# AND EndDate > #" & Me!StartDate & "#"
If there is an overlapping record, the query will return RecordCount > 0
(the new record is excluded from the query).
Where the date is "unambiguous" (ie, not valid in American format, such as
"20/12/2000"), the checks seem to work just fine. It is where the dates may
be "ambiguous" (eg, "08/06/2000" which is a valid, but different, date in
both formats) that it goes off the rails. Although the PC and the table are
set up for DD/MM/YYYY format, a date such as "08/06/2000" seems to be
treated as "06/08/2000"). If I reverse the date entry in the form to the US
format, the check works OK.
On the other hand, if I enter an unambiguous date in the US format, Access
kindly corrects it and displays the date in DD/MM/YYYY format -- so it
definitely knows the format to be used. However, if I enter a literal
#DD/MM/YYYY# into VBA, it is automatically adjusted to #MM/DD/YYYY#. This
has never been a problem before.
Any suggestions? Please???
TIA.
--
Cheers,
Lyn. 3 11549
Take a look at http://www.mvps.org/access/datetime/date0005.htm. I use this
all the time and it works great.
HJ
"Lyn" <lh******@ihug.com.au> wrote in message
news:co**********@lust.ihug.co.nz... Hi, I am developing a project in which I am checking for records with overlapping start/end dates. Record dates must not overlap date of birth, date of death, be in the future, and must not overlap existing records
from the same table.
I had this all working some time ago, but recently when I have gone back
to do more testing, part of these validations no longer work. While there
have been changes to the code in the meantime, I cannot see any changes that could account for the current problem.
I am working with Access 2003 in WinXP, and the regional date format is
set to International format DD/MM/YYYY. I am pretty sure that the problem involves the latter date format and that if my PC was using American
format there would not be a problem.
To specifics -- the following dates are date fields in the form:
Me!DOB (date of birth) Me!DOD (date of death -- set to 31/12/9999 if still alive) Me!StartDate (new record start date -- bound to the table) Me!EndDate (new record end date -- bound to the table)
The table has the following date fields (in short date format):
StartDate EndDate
Validations against DOB, DOD and TODAY (future date check) still work
fine. To check for overlapping of existing records, I use an SQL query with the following WHERE clause for Me!StartDate check (similar SQL for Me!EndDate check):
WHERE StartDate < #" & Me!StartDate & _ "# AND EndDate > #" & Me!StartDate & "#"
If there is an overlapping record, the query will return RecordCount > 0 (the new record is excluded from the query).
Where the date is "unambiguous" (ie, not valid in American format, such as "20/12/2000"), the checks seem to work just fine. It is where the dates
may be "ambiguous" (eg, "08/06/2000" which is a valid, but different, date in both formats) that it goes off the rails. Although the PC and the table
are set up for DD/MM/YYYY format, a date such as "08/06/2000" seems to be treated as "06/08/2000"). If I reverse the date entry in the form to the
US format, the check works OK.
On the other hand, if I enter an unambiguous date in the US format, Access kindly corrects it and displays the date in DD/MM/YYYY format -- so it definitely knows the format to be used. However, if I enter a literal #DD/MM/YYYY# into VBA, it is automatically adjusted to #MM/DD/YYYY#. This has never been a problem before.
Any suggestions? Please???
TIA. -- Cheers, Lyn.
HJ,
Thanks for the tip. I will try it and repost if I still have a problem.
--
Cheers,
Lyn.
"HJ" <hj********@spamhotmail.com> wrote in message
news:41***********************@dreader17.news.xs4a ll.nl... Take a look at http://www.mvps.org/access/datetime/date0005.htm. I use this all the time and it works great.
HJ
"Lyn" <lh******@ihug.com.au> wrote in message news:co**********@lust.ihug.co.nz... Hi, I am developing a project in which I am checking for records with overlapping start/end dates. Record dates must not overlap date of birth, date of death, be in the future, and must not overlap existing records from the same table.
I had this all working some time ago, but recently when I have gone back to do more testing, part of these validations no longer work. While there have been changes to the code in the meantime, I cannot see any changes that could account for the current problem.
I am working with Access 2003 in WinXP, and the regional date format is set to International format DD/MM/YYYY. I am pretty sure that the problem involves the latter date format and that if my PC was using American format there would not be a problem.
To specifics -- the following dates are date fields in the form:
Me!DOB (date of birth) Me!DOD (date of death -- set to 31/12/9999 if still alive) Me!StartDate (new record start date -- bound to the table) Me!EndDate (new record end date -- bound to the table)
The table has the following date fields (in short date format):
StartDate EndDate
Validations against DOB, DOD and TODAY (future date check) still work fine. To check for overlapping of existing records, I use an SQL query with the following WHERE clause for Me!StartDate check (similar SQL for Me!EndDate check):
WHERE StartDate < #" & Me!StartDate & _ "# AND EndDate > #" & Me!StartDate & "#"
If there is an overlapping record, the query will return RecordCount > 0 (the new record is excluded from the query).
Where the date is "unambiguous" (ie, not valid in American format, such as "20/12/2000"), the checks seem to work just fine. It is where the dates
may be "ambiguous" (eg, "08/06/2000" which is a valid, but different, date in both formats) that it goes off the rails. Although the PC and the table are set up for DD/MM/YYYY format, a date such as "08/06/2000" seems to be treated as "06/08/2000"). If I reverse the date entry in the form to the US format, the check works OK.
On the other hand, if I enter an unambiguous date in the US format, Access kindly corrects it and displays the date in DD/MM/YYYY format -- so it definitely knows the format to be used. However, if I enter a literal #DD/MM/YYYY# into VBA, it is automatically adjusted to #MM/DD/YYYY#. This has never been a problem before.
Any suggestions? Please???
TIA. -- Cheers, Lyn.
Tried it and it works fine. I will add the constants to all my projects.
Thanks again.
--
Cheers,
Lyn.
"Lyn" <lh******@ihug.com.au> wrote in message
news:co**********@lust.ihug.co.nz... HJ, Thanks for the tip. I will try it and repost if I still have a problem. -- Cheers, Lyn.
"HJ" <hj********@spamhotmail.com> wrote in message news:41***********************@dreader17.news.xs4a ll.nl... Take a look at http://www.mvps.org/access/datetime/date0005.htm. I use this all the time and it works great.
HJ
"Lyn" <lh******@ihug.com.au> wrote in message news:co**********@lust.ihug.co.nz... Hi, I am developing a project in which I am checking for records with overlapping start/end dates. Record dates must not overlap date of birth, date of death, be in the future, and must not overlap existing records from the same table.
I had this all working some time ago, but recently when I have gone back to do more testing, part of these validations no longer work. While there have been changes to the code in the meantime, I cannot see any changes that could account for the current problem.
I am working with Access 2003 in WinXP, and the regional date format is set to International format DD/MM/YYYY. I am pretty sure that the problem involves the latter date format and that if my PC was using American format there would not be a problem.
To specifics -- the following dates are date fields in the form:
Me!DOB (date of birth) Me!DOD (date of death -- set to 31/12/9999 if still alive) Me!StartDate (new record start date -- bound to the table) Me!EndDate (new record end date -- bound to the table)
The table has the following date fields (in short date format):
StartDate EndDate
Validations against DOB, DOD and TODAY (future date check) still work fine. To check for overlapping of existing records, I use an SQL query with the following WHERE clause for Me!StartDate check (similar SQL for Me!EndDate check):
WHERE StartDate < #" & Me!StartDate & _ "# AND EndDate > #" & Me!StartDate & "#"
If there is an overlapping record, the query will return RecordCount > 0 (the new record is excluded from the query).
Where the date is "unambiguous" (ie, not valid in American format, such as "20/12/2000"), the checks seem to work just fine. It is where the dates
may be "ambiguous" (eg, "08/06/2000" which is a valid, but different, date in both formats) that it goes off the rails. Although the PC and the table are set up for DD/MM/YYYY format, a date such as "08/06/2000" seems to be treated as "06/08/2000"). If I reverse the date entry in the form to the US format, the check works OK.
On the other hand, if I enter an unambiguous date in the US format, Access kindly corrects it and displays the date in DD/MM/YYYY format -- so it definitely knows the format to be used. However, if I enter a literal #DD/MM/YYYY# into VBA, it is automatically adjusted to #MM/DD/YYYY#. This has never been a problem before.
Any suggestions? Please???
TIA. -- Cheers, Lyn.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Donnal Walter |
last post by:
I was very surprised to discover that
>>> import datetime
>>> x = datetime.date(2004, 9, 14)
>>> y = datetime.datetime(2004, 9, 14, 6, 43, 15)
>>> print x == y
True
How can these two...
|
by: Scott Knapp |
last post by:
Good Day -
I have a form which sets the current date, as follows:
<script type="text/javascript">
xx=new Date()
dd=xx.getDate()
mm=xx.getMonth()+1
yy=xx.getYear()
mmddyy=mm+"/"+dd+"/"+yy...
|
by: sylvian stone |
last post by:
Hi,
I've used standard date functions in the past, but need to create
something a little different, as I am working on an investment
calculator.
What I need to do is validate two dates, and...
|
by: Karl Gibbon |
last post by:
Hi There,
I currently have a database in Access 2002 with several
forms. I would like to restrict access to one form in perticular until
November 1st every year. My current method (attempted...
|
by: MarkAurit |
last post by:
Im having difficulty coming up with a good algorithm to express the following
comparison:
"if <a given date> falls between the (current date - 5 days) and the
(current date)"
Obviously....
|
by: Tiya |
last post by:
Hi there !!!
I would like to know how to compare dates in javascript.
var sdate = new Date(theform.SubmissionDate.value);
var odate = new Date(theform.StartDate.value);
var todaysdate = new...
|
by: blini |
last post by:
Helo.... How I can convert string "26/03/2006 15:51" for a date? I need
to convert and to compare if "09/06/2006 14:20" is lesser or equal that
the current date. Everything in Javascript.
|
by: mr.nimz |
last post by:
hello,
this is antenio. recently i've come to a problem. i got a way through
it, somehow, still it left me in a curious state, so i'm posting it
here, if i can get an answer from some techy,
...
|
by: noone |
last post by:
Hi,
I am designing an application which displays news topics until midnight
on the DisplayUntil date and then they should drop out. Unfortunately,
they seem to be dropping out at mid-day.
I'm...
|
by: anagai |
last post by:
I just want to check if a date entered in a textbox is equal to the
current system date. I set the date object from the input field like
this:
dt1=new Date('10/01/2007');
the current system...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |