Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving dates in predefined format

Status
Not open for further replies.

gransbpa

Programmer
Jun 5, 2001
98
NL
I have a multi-user database in which dates have to be stored. However, some users use default windows-settings DD-MM-YYYY, others MM-DD-YYYY. As a result, the database has become corrupt. The format-command doesn't seem to work.Is there another way to format the data at the access-level, so that data will be saved independent of the default-settings?
 
I'm sure this post will receive a few detailed responses, therefore this will be a general one.<g>

The Format function in Access allows you lay out the Date / Time in anyway you wish! The CDate function will allow conversion. See the Access Help file for a complete list of available options.

I'm afraid I fail to see how you are getting corruption unless you are mistakenly hard coding dates! The obvious method is to save as a string then convert when you wish
to.

As mentioned previously, check out the detail given in the Access Help file. Almost all the info you could ever need is there ..

Regards,


Chris
Xeotech
 
Actually, if / when your save date data type to anyMDB table, the format doesn't matter. Within the caverns of the db, MS treats DATES as a floating point number where the Integer portion is the number of DAYS from 12/30/1998, and the fractional (Decimal) part is the Part of the day since midnight (e.g. 0.5 is noon, 0.25 is 6:00 AM, 0.75 is 9:00 PM ...). Designating the data as date type just applies a formating to the date variable. It CAN cause some problems, as dates like 1/2/yy are not CLEARLY distinguished from 2/1/yy when users ENTER the values and the international settings will only reallly recognise a single date format for an individiual machine, However I have never actually SEEN a database become &quot;CORRUPTED&quot; from this, just that some dates are &quot;WRONG&quot;. The only soloution I am aware of is to enforce a company &quot;policy&quot; at the individual level to use A standard date format.

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top