View Single Post
  #2  
Old May 23rd, 2004, 07:27 PM
Steve Schapel
external usenet poster
 
Posts: n/a
Default Dates In Queries

Roland,

What data do you have there? When you talk about Month, do you mean you
have a date field, of Date/Time data type, and you are referring to the
month portion of this data? Or do you mean you have a Month field, the
data enterned into which is the name of the month in text? If you have
a date field, and if you want all your records in chronological order,
just apply the sort to the date field. If you have a date field, and
you want the records sorted by month, and then a secondary sort within
each monthly grouping based on some other field, then you can make a
calculated field in your query, something like this...
MonthNumber: Format([YourDateField],"yymm") and use this to sort. If,
however, your data is the name of the month in text, you will need to
cross-reference this in some way to the month number. Easiest way to do
this probably is to make a separate table, 2 fields, with the name of
the month and the month number, add this to your query and join to the
existing table vie the MonthName field, and then you can include the
MonthNumber field from this reference table as the sorting field in your
query.

--
Steve Schapel, Microsoft Access MVP


Roland Hanson wrote:
I have set up a query to add up some data. I used the wizard to set
it up, I set the fields I wanted added, then it asked how I wanted
my dates handled and I selected by Month. All of this works fine,
but when I very the results in datasheet view, the months are not
sorted properly. I went into design view and selected to sort by the
needed column, but still no luck. The problem is that the month/year
is being sorted alphabetically instead of chronologically. Is there
any way to fix this, I am looking around in what I have for an answer
but can't seem to find anything.

Thank you for your assistance.

R. Hanson