473,418 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

Access date validation driving me nuts

Hi
I have a very simple problem indeed, but I am unable to solve it. I
am inputing a short date into an unbound text box with a short date
input mask. I am in the UK so my date format is dd/mm/yyyy. Everything
works superbly well with one exception.
Example: Suppose I accidentally keyed in 04/13/2005 the program
assumes that I meant 13/04/2005 and swaps the day and the month field
around without displaying an error, so the date is incorrectly
processed as 13/04/2005. How do I stop this please?

Regards
Carriolan
Dec 4 '05 #1
11 6177

<carriolan@> schreef in bericht news:n9********************************@4ax.com...
Hi
I have a very simple problem indeed, but I am unable to solve it. I
am inputing a short date into an unbound text box with a short date
input mask. I am in the UK so my date format is dd/mm/yyyy. Everything
works superbly well with one exception.
Example: Suppose I accidentally keyed in 04/13/2005 the program
assumes that I meant 13/04/2005 and swaps the day and the month field
around without displaying an error, so the date is incorrectly
processed as 13/04/2005. How do I stop this please?

Regards
Carriolan


Hi Carriolan,
I don't think you can stop Access from trying to be a intelligent program. ;-)
Since there is NO month 13 Access guesses you made a mistake.
AFAIK you can not stop this behaviour.
You can however check the date yourself (before update event) and present a nice messagebox to the user.
Let us know if you need more help on this.

Arno R
Dec 4 '05 #2
How about wring some vba to check each portion of the date?

Split the string based on location of / or - into an array then process
the array, making sure that month is between 1 and 12. If it isn't
give error msg.

Dec 4 '05 #3
Hi
I found auto correct was set to 'yes'. Now this gets me part way
there. It prevents the date from being switched around, but it still
does not trap the error 04/15/2005. This is really strange as I am
using a default date of today which comes up in dd/mm/yyyy format. It
appears to allow both dd/mm/yyyy and mm/dd/yyyy formats - how do I
stop this please?

Regards
Carriolan
Dec 4 '05 #4
Hi
I found auto correct was set to 'yes'. Now this gets me part way
there. It prevents the date from being switched around, but it still
does not trap the error 04/15/2005. This is really strange as I am
using a default date of today which comes up in dd/mm/yyyy format. It
appears to allow both dd/mm/yyyy and mm/dd/yyyy formats - how do I
stop this please?

Regards
CarriolanOn Sun, 4 Dec 2005 23:58:37 +0100, "Arno R"
<ar***********@tiscali.nl> wrote:

<carriolan@> schreef in bericht news:n9********************************@4ax.com...
Hi
I have a very simple problem indeed, but I am unable to solve it. I
am inputing a short date into an unbound text box with a short date
input mask. I am in the UK so my date format is dd/mm/yyyy. Everything
works superbly well with one exception.
Example: Suppose I accidentally keyed in 04/13/2005 the program
assumes that I meant 13/04/2005 and swaps the day and the month field
around without displaying an error, so the date is incorrectly
processed as 13/04/2005. How do I stop this please?

Regards
Carriolan


Hi Carriolan,
I don't think you can stop Access from trying to be a intelligent program. ;-)
Since there is NO month 13 Access guesses you made a mistake.
AFAIK you can not stop this behaviour.
You can however check the date yourself (before update event) and present a nice messagebox to the user.
Let us know if you need more help on this.

Arno R

Dec 4 '05 #5
Many developers do not permit the direct entry of a date because of the
difficilties you describe. They use some form of a pop-up calendar and
a click on date method which populates the text field. There are many
pop-up calendars and a google search of this newsgroup is likely to
locate some good ones.
You can format the text box as something like d-mmm-yyyy which may give
you something like 4-dec-2005, but when you set the focus to the
control, it's likely the date will show in your regional settings
format, in my case, 2005-12-04.
On the net, one rarely sees the direct entry of a date being allowed. A
common solution seems to be three combo boxes, one for year, one for
month (names rather than numbers) and day. This of course, requires
some coding to get the date from the three combo boxes.

Dec 4 '05 #6
"Lyle Fairfield" <ly***********@aim.com> wrote
Many developers do not permit the direct entry of a date because of the
difficilties you describe. They use some form of a pop-up calendar and
a click on date method which populates the text field. There are many
pop-up calendars and a google search of this newsgroup is likely to
locate some good ones.
Two calendar-style date pickers, from knowledgeable sources, may be found at
Stephen Lebans' site, http://www.lebans.com and Drew Wutka's site,
http://www.wolfwares.com. There are many others that can be found, as Lyle
states, by Googling. Both of these, IIRC, are done entirely with native
Access objects, so do not require distributing an ActiveX control with your
database.
On the net, one rarely sees the direct entry of a date being allowed. A
common solution seems to be three combo boxes, one for year, one for
month (names rather than numbers) and day. This of course, requires
some coding to get the date from the three combo boxes.


And, it seems hardly worth the trouble, considering the wide availability of
easy-to-use date pickers where experienced developers have already done the
"heavy lifting".

Larry Linson
Microsoft Access MVP
Dec 5 '05 #7
Hi Larry
I think you have it. Custom and practice dictate that I should not
allow direct date entry into a date field. I have one question
however. I use Access 2003, which has a calendar control. Is there a
catch to using this, if I am going to ditribute the app to 3rd
parties?

Regards
Carriolan

On Mon, 05 Dec 2005 04:17:24 GMT, "Larry Linson"
<bo*****@localhost.not> wrote:
"Lyle Fairfield" <ly***********@aim.com> wrote
Many developers do not permit the direct entry of a date because of the
difficilties you describe. They use some form of a pop-up calendar and
a click on date method which populates the text field. There are many
pop-up calendars and a google search of this newsgroup is likely to
locate some good ones.


Two calendar-style date pickers, from knowledgeable sources, may be found at
Stephen Lebans' site, http://www.lebans.com and Drew Wutka's site,
http://www.wolfwares.com. There are many others that can be found, as Lyle
states, by Googling. Both of these, IIRC, are done entirely with native
Access objects, so do not require distributing an ActiveX control with your
database.
On the net, one rarely sees the direct entry of a date being allowed. A
common solution seems to be three combo boxes, one for year, one for
month (names rather than numbers) and day. This of course, requires
some coding to get the date from the three combo boxes.


And, it seems hardly worth the trouble, considering the wide availability of
easy-to-use date pickers where experienced developers have already done the
"heavy lifting".

Larry Linson
Microsoft Access MVP

Dec 5 '05 #8
Hi Lyle
This is v. good advice - thanks.
Regards
Carriolan
On 4 Dec 2005 15:48:37 -0800, "Lyle Fairfield" <ly***********@aim.com>
wrote:
Many developers do not permit the direct entry of a date because of the
difficilties you describe. They use some form of a pop-up calendar and
a click on date method which populates the text field. There are many
pop-up calendars and a google search of this newsgroup is likely to
locate some good ones.
You can format the text box as something like d-mmm-yyyy which may give
you something like 4-dec-2005, but when you set the focus to the
control, it's likely the date will show in your regional settings
format, in my case, 2005-12-04.
On the net, one rarely sees the direct entry of a date being allowed. A
common solution seems to be three combo boxes, one for year, one for
month (names rather than numbers) and day. This of course, requires
some coding to get the date from the three combo boxes.

Dec 5 '05 #9

<carriolan@> schreef in bericht news:4i********************************@4ax.com...
Hi Larry
I think you have it. Custom and practice dictate that I should not
allow direct date entry into a date field. I have one question
however. I use Access 2003, which has a calendar control. Is there a
catch to using this, if I am going to ditribute the app to 3rd
parties?


IMO it's better to use this on or another not-activeX one:
http://allenbrowne.com/ser-51.html

Arno R
Dec 5 '05 #10
Arno R wrote:
<carriolan@> schreef in bericht news:4i********************************@4ax.com...
Hi Larry
I think you have it. Custom and practice dictate that I should not
allow direct date entry into a date field. I have one question
however. I use Access 2003, which has a calendar control. Is there a
catch to using this, if I am going to ditribute the app to 3rd
parties?


IMO it's better to use this on or another not-activeX one:
http://allenbrowne.com/ser-51.html

Arno R


Thirty-three of us have written the best popup calendar and each of them
is better than the other thirty-two.

--
Lyle Fairfield
Dec 5 '05 #11
"ca*******@blootoo.com" <carriolan@> wrote in
news:vv********************************@4ax.com:
I found auto correct was set to 'yes'. Now this gets me part way
there. It prevents the date from being switched around, but it
still does not trap the error 04/15/2005. This is really strange
as I am using a default date of today which comes up in dd/mm/yyyy
format. It appears to allow both dd/mm/yyyy and mm/dd/yyyy formats
- how do I stop this please?


Are you sure your Windows location settings are correct? I would
have thought that if the Windows regional settings are correct, that
date formats would get handled according to UK standards.

I once had to deal with this for an application that was used in NYC
and London, and it worked out fine. But I did *not* use input masks.
Perhaps it is only the input masks that are causing the problem?

The one place where I had to take action was in SQL strings written
in code, where I had to use DateSerial(), since Jet SQL works only
with US date order.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Dec 5 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: S.Patten | last post by:
Hi, I have a problem with updating a datetime column, When I try to change the Column from VB I get "Incorrect syntax near '942'" returned from '942' is the unique key column value ...
1
by: Darren Lew | last post by:
Hi there, I have this problem which is really driving me nuts for a couple of days. Glad if any help or suggestion is given Javascript will give me a pop-up error "Access is denied" when i try...
14
by: Crimsonwingz | last post by:
Need to calculate a sum based on a number of factors over a period of years. I can use formula ^x for some of it, but need totals to carry over in the sum and have only been able to do this thus...
1
by: TN Bella | last post by:
Hello, I was looking through the older posts for a solution to this problem, but I am still confused on how to fix my problem. There are two dates on my form, one (txtInvDate) is entered by the...
4
by: trond | last post by:
Hello all, Before I start I'd like to point out that I am a complete novice when it comes to asp.net - My background is in network and operating systems, and although I have been doing a bit of...
1
by: Ray Nimmo | last post by:
This is driving me nuts, been at it now for the last week, anyone any ideas on wher im going wrong? using a list box pipeLB and a date/time picker pDate, im trying to populate the list box with...
7
by: Silvergun | last post by:
Sorry if this is a little basic, but I'm a real newbie with Access, and this is driving me crazy. What I'm trying to do is use the Count function in such a way that I can get it to return values...
1
by: tulikapuri | last post by:
Friends , i want to chart the data from report for on daily, weekly and monthly basis and i have three variable i.e. time , date and Moisture. Can someone guide me how to arroach this issue,...
7
jinalpatel
by: jinalpatel | last post by:
I have two tables Mainfirm and Subfirm. I have everything ready. Now I am entering validation rules like as below in my form fields to protect the tables from bad data. But when I try to enter...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.