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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|