View Full Version : Saving Date format in tables


David Eagar
02-04-2008, 04:22 PM
Embarrasing question, but my serches have proved fruitless.

Saving a Date field (Short Date) is saving as 1/02/2008 or 27/02/2008 in the table. Formatting this data in a query as dd/mm/yyyy displays correctly, but the mid function mid([Date],4,2) still picks up the table format, not the query format

My objective is to extract the 02 (month) using the mid function in a query. Beacuase the length of the day component varies from 1 to 2 characters, this is proving impossible

Is there a way to save the date as 02/02/2008 in the table?

Tried using input mask dd/mm/yyyy but kept getting invalid format error

Any help appreciated

RuralGuy
02-04-2008, 04:51 PM
A DateTime field in a table is *always* stored in the same way. This link should help explain this: http://support.microsoft.com/default.aspx/kb/q130514/

Mike375
02-04-2008, 06:49 PM
I am sure I am missing something here but why not Newfield:Month([xyz]) and with the aid of Count turn the 1, 2, 3 etc into 01, 02, 03

David Eagar
02-04-2008, 11:10 PM
I am sure I am missing something here but why not Newfield:Month([xyz]) and with the aid of Count turn the 1, 2, 3 etc into 01, 02, 03

Doesn't work exactly, but has pointed me in much simpler direction

Thanks

Ron_dK
02-04-2008, 11:54 PM
My objective is to extract the 02 (month) using the mid function in a query.

David,

You might try the datepart function in your query :
e.g. Expr1: DatePart("m",Now())


Hth

boblarson
02-04-2008, 11:58 PM
Or even

MyMonth:Format([DateField],"mm")