Re: Format Function - Access 2000
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Wed, 26 Mar 2008 20:39:13 +0900
Don't use the Format() function in a query.
Its output is always interpreted as Text, so the sort will be nonsense.
Instead, leave the field as a date, and use the Format property of the field (in the properties box.)
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"paulmitchell507" <paulmitchell507@xxxxxxxxxxxxxx> wrote in message
news:6332c8b8-4575-4f16-b826-23be339a509b@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Dear All,
I am running a simple query on a table called [Opportunity] that has a
field called [ClosedDate] containing dates with a data type of date
\time.
If I sort the [ClosedDate] field using any of the named formats i.e
short date, long date etc. the dates are sorted as your would expect.
However, I would like to use a custom format of "mm/yy".
So the query looks as follows,
Field: ClosedDate: Format([Opportunity]![CloseDate],"mm/yy")
Table:
Sort: Descending
Which outputs the dates as 03/08, 02/09 etc. I assume that the format
function is returning the data as a string, so when I sort the dates
03/08 is above 02/09. I would like use my custom format but keep
original data type of date\time. Can anybody offer any guidance?
.
- Follow-Ups:
- Re: Format Function - Access 2000
- From: DFS
- Re: Format Function - Access 2000
- From: Guillermo_Lopez
- Re: Format Function - Access 2000
- References:
- Format Function - Access 2000
- From: paulmitchell507
- Format Function - Access 2000
- Prev by Date: Format Function - Access 2000
- Next by Date: Re: Emulate 4th argument of OpenReport method in OutputTo method?
- Previous by thread: Format Function - Access 2000
- Next by thread: Re: Format Function - Access 2000
- Index(es):
Relevant Pages
|