Link to home
Start Free TrialLog in
Avatar of WillHudson
WillHudsonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

my dates keep automatically changing the days, months and years round when i don't want them to!

Hi, I have a database for holding orders that come to my company and along with other data it has to hold the date this order was from which gets typed in manually.

I made an input mask of: 99/99/00;0;_    to make the  /  /  automatically come up so they wouldn't need to be typed in manually but i originally had the date format dd/mm/yy to show the days, months and years correctly but it kept switching them around for no reason.  I've also tried changing it to short date and removing the format so it would stay as it was typed but it's still doing it and i don't know why.

if you typed 29th Oct 2004 it would change to 10/ 4/29.

how do i fix this?
Avatar of Nestorio
Nestorio

Have you tried setting the format property to "dd/mm/yyyy"?
ASKER CERTIFIED SOLUTION
Avatar of rockiroads
rockiroads
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of WillHudson

ASKER

the regional setting is GMT (greenwich mean time)
I've tried the four-didget year format, it comes up with silly dates like 2019 as the year!!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
dont bother with the masking, some people may prefer to enter dates using . or -

u could use the BeforeUpdate function to validate the input

private sub txtDateField_BeforeUpdate(Cancel as Integer)
    if nz(txtDateField.Value,"") <> "" then
          if IsDate(txtDateField.Value)=False then
               msgbox "Invalid date"
               cancel = true  'force user to stayin field
          endif
     endif
end sub


alternatively do what I did, create a combobox that holds the list of month names and years (depends on your application of course, mine is set to enter different years, but then I dont need to enter a day)

never mind, i give up and i'll just make it a text field.
Do not accept this as an answer.

Personally, I'd go with leeskelton83 and use a calendar control.  No confusion that way.  The setting Rockiroads was refering to is in the Regional Options dialog, under the "Date" tab.  There you can set the default format in which your dates are displayed, and Access adheres to this selection unless forced to do otherwise in code.