A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Dates In Queries



 
 
Thread Tools Display Modes
  #1  
Old May 23rd, 2004, 07:01 PM
Roland Hanson
external usenet poster
 
Posts: n/a
Default Dates In Queries

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
  #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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.