Sorting By Date
Sep 9, 2006
Hi,
I've just started playing with Access 2002 (Office XP) and I@m having a little bit of trouble.
I'm using the Query Wizard to summarise my database giving me average values for each month. When the query is first run it displays in the correct month order: April, May, June, July, August, September. But viewing the query again or when trying to graph the data in a Form, the sorting forces alphabetical order: April, August, July, June, May, September.
How can I get the query/form to return the results in true month order?
Here's the SQL info which the Wizard created:
SELECT DISTINCTROW Format$([Raw Data].[TimeStamp],'mmmm yyyy') AS [TimeStamp By Month], Avg([Raw Data].[Indoor Temperature]) AS [Avg Of Indoor Temperature], Min([Raw Data].[Indoor Temperature]) AS [Min Of Indoor Temperature], Max([Raw Data].[Indoor Temperature]) AS [Max Of Indoor Temperature]
FROM [Raw Data]
GROUP BY Format$([Raw Data].[TimeStamp],'mmmm yyyy'), Year([Raw Data].[TimeStamp])*12+DatePart('m',[Raw Data].[TimeStamp])-1;
Thanks in advance for your help.
David
View Replies
ADVERTISEMENT
Oct 7, 2005
I have the data below in a query in Access, and I want it to sort by the Week Begin date.
I have put a sort on for 'Ascending' but it doesn't work. (Due to the 29th being after the 28th - regardless of month)
Is there any way I can force the sort in this query ?
It must be in the same query though, as I could probably do it by using this query in another one then sorting that. However, I don't want to do that for reasons I won't bore you with.
WeekBegin Count
05/09/05 137
12/09/05 90
19/09/05 22
26/09/05 55
29/08/05 122
PS - I should mention that I think it is because the WekBegin date is an expression based on an actual date field. Therefore I believe it's treating it as some sort of text field.
Any help would be appreciated.
Thanks.
J.
View 2 Replies
View Related
Feb 28, 2005
I have a subform that simulates a listbox and I click on the header label to activate the sort. My problem is sorting by date. Below is the sort function and one of the date labels that I need to sort on.
Sort Function:Code:
==========================================
Private Function SortOrder(col As String, xorder As String) As Integer
Dim strSQL As String
Dim sf As Form
Set sf = Forms!frmMainEntry!fctlNotifications.Form
strSQL = "SELECT DISTINCTROW ProgramID, ProgramDescription, Facility, ResponsibleParty, DueDate, FrequencyOfService, AdvancedNoticeDate "
strSQL = strSQL & "FROM qryProgramList "
strSQL = strSQL & "ORDER BY " & col & " " & xorder
sf.RecordSource = strSQL
sf.Form.Requery
End Function
==========================================
On-Click Date:Code:
==========================================
Private Sub lblDueDate_Click()
Dim response As Integer
If Me.txtSortOrder = "DESC" Then
response = SortOrder(CDate(DueDate), "asc")
Me.txtSortOrder = "asc"
Else
response = SortOrder(CDate(DueDate), "DESC")
Me.txtSortOrder = "DESC"
End If
End Sub
==========================================
I'm not sure if I should convert the date into something that can be sorted or just leave it as a date. I can't get it to work. Help please.
Thanks,
PC
View 14 Replies
View Related
Apr 2, 2006
help w/sorting two columns one with date checked out, other with date due back. some are overdue and there is not a date entered yet. need to sort by the longest overdue first and leave out those that have already been returned
View 3 Replies
View Related
Apr 28, 2005
Hello,
I am having some trouble sorting my date and times. I have them both working great individually with RunCommand Sort Ascending after Update. The problem is, the dates will get jumbled up after the time is sorted. Is there a way to connect the two fields where the dates will always stay in order? I have attached a pic of this DB if it helps any. Thanks so much for any help.
Fritz
View 3 Replies
View Related
Jul 4, 2005
i have a date field where about 80% of the data is entered in the format dd/mm/yyyy but the rest may be year only since the exact date is not known. Therefore, it does not have an input mask or a format set. Is it still possible to sort on that field? (As i write this i realise it is probably a dumb question but always worth a shot!)
View 3 Replies
View Related
Jul 13, 2006
Hey all,
I have what is probably a simple question.
I want to sort my date field in a query by the most recent date.
When I use ascending or descending it looks at the Month/day/year to sort it.
I need it to look at year/day/month.
Any help would be awesome.
View 1 Replies
View Related
Apr 3, 2007
I created a query which at first was simply to run a query which asks you for a drivers name, however we have decided that now we want to sort by the employee name as well as by a specified date range. I originaly had it set up to select the driver name with this in the criteria field in the Driver Name column:
[Enter Driver Name]
Then I tried to enter the following in to the criteria field in the date column:
Between [Enter Start Date: (Format MM-DD-YY)] And [Enter End Date: (Format MM-DD-YY]
However when I run the query it asks me for the date about 4 times, and then it goes to a blank report. I am sure I am not doing this properly somehow, anyone care to help out?
View 1 Replies
View Related
Oct 7, 2007
I have a cross tab query for which I want to display the dayes in mmm-yy format. I am grappling with the problem that this is essentially a string, so gets sorted alphanumerically.
Having read around related forums I have tried basing the XTab on a select query, which is sorted by the conventialal date, but also has another field that gives a date using Format([DateAdded],"mmm-yy").
Trouble is, Access only lets me bring across 1 column heading, so I must sort on the column I display, and this doesn't solve the problem.
The coulmn headings are not be fixed (i.e. "Jan";"Feb" etc) as the months are financial year months (April - March).
I can get this too work by using yyyy/mm, but my board of directors are not happy with this format.
Any ideas. I would be open to re-querying my Xtab from another query of from a report if that worked.
Cheers
Mike
View 4 Replies
View Related
Jul 27, 2014
I have a query where I ORDER BY ClientId, MatterId and Transdate. The result of the query is correct. All of the transdates are in ASC order within the Matter.
When I run the report for a MatterId the relative transactions are not sorted on transdate
Can there be something in the report that could be effecting the order of the transactions.
View 3 Replies
View Related
Jan 27, 2015
I have a field on a table that is a DateTime format and it needs to be that way. I am trying to query that table for all the dates to use in a combobox but I only wat the date not the time. The problem is when I format the field to just date I can't sort it anymore as a date and I can't group them. I still get multiple lines in my combobox because there multiple times for the same day. what is the proper way in a query to extract just the date from a field and still sort it as date ie 1/12/2015 is greater than 12/15/2014?
View 8 Replies
View Related
Feb 21, 2014
I have a subform which tracks all the notes our personnel have entered in a specific project (which is the main form).
The issue is that I want the most current note to show in the subform when the project is "opened up". The underlying query for the subform has the [DATE] field sorted on "Descending".
View 2 Replies
View Related
Mar 10, 2006
Hi all.
I've created a database which contains information about stores. I want to have the forms automaticly sorted by the department number.
I've tried to sort the table by department, but when I try to add a department, the sorting doesn't seem to affect the form at all.
Lets say I have department 1,2,3,6,7,8 in the form, and I add department 4, it will be the last post in the form. I want it to be the fourth, and so on..
I'd apreciate some help with this :) Thanks
Here's the database (http://www.access-programmers.co.uk/forums/attachment.php?attachmentid=12934&stc=1&d=1142018915&PHPSESSID=f730b7f11f6983965698faeacbe5a1ee)
View 5 Replies
View Related
Jun 14, 2007
Hi Everyone,
Could anyone tell me how I sort a field so it sorts by the surname, not the first name? It's one field with 2 names seperated by a space, i.e. George Michael.
Many thanks for any help.
Essex
View 5 Replies
View Related
Jan 1, 2008
I am doing a database containing names, dates of birth, dates of death etc of my ancestors. Does anyone know the best way of displaying it so I can sort them out by age of death? For example, I want to see someone for example who died aged 70 years and 6 months to be a place above someone who died aged 70 years and 4 months.
View 1 Replies
View Related
Jun 26, 2007
In Quebec there are a lot of place names beginning with "Saint-" or "Sainte-".
When I do an ascending sort on the table itself, these type of names don't seem to follow the expected pattern.
For the names Sainte-Marthe, Sainte-Thérèse, Saint-Ephrem, Saint-Eulalie I should see this order:
Saint-Ephrem, Saint-Eulalie, Sainte-Marthe, Sainte-Thérèse.
Instead, I get Sainte-Marthe, Saint-Ephrem, Sainte-Thérèse, Saint-Eulalie.
The names are spelled exactly as I have them in the table with hyphens and diacritic marks.
Any ideas why there seems to be a problem sorting "Saint-" from "Sainte-?
View 8 Replies
View Related
Jan 10, 2007
Yet another question! When I run the report, it gives me the results in alphabetical order (i.e. April August, etc) instead of monthly order... Is there a way to fix this?
Thanks!
Michele
View 5 Replies
View Related
Jul 26, 2007
I have a field with addresses (numbers and letters) Whenever I try to sort it sorts by the number. How do I get it to only sort by the letters but still include the numbers in the result?
View 1 Replies
View Related
Oct 4, 2005
I have been trying to solve this Access problem for a couple of weeks. I have 2 Access 2002 files where I import info from a Paradox DB. I have been doing this for 12 years. I just bought a new laptop and transferred the programs over (I didn't reinstall because I don't have a floppy drive). Paradox files have a default of an International sort order.
One of my 2 Access files is now requiring an Ascii sort order. The Paradox forum says that something in the Access file is asking for the Ascii sort sequence. I have to keep bouncing back and forth in the Regedit changing the sort order from International to Ascii and back again to use the 2 files.
Do you know how I can make the 1 Access file ask for the International sort order?
View 4 Replies
View Related
Jan 11, 2006
I have a table with an alphanumeric field I want to sort on. If I sort the usual ascending way, data that is numeric is sorted before data that is alpha.
Is there a way to have the alpha data sorted ascending come out ahead of the numeric data srted ascending?
Ex:
Currently,
1
2
3
A
B
c
Desired:
A
B
C
1
2
3
Thanks in advance to all who reply!!!
View 3 Replies
View Related
Jan 25, 2006
i have a simple datsbase with 2 fields - drawing number and description.
the drawing numbers are in the formatt STD123 e.t.c.
When I try to sort numerically the order ends up as
STD1
STD10
STD11
STD100
STD101..........
How do I get it to list in true numeric order in report and table view i.e.
STD1
STD2
STD3.......... Please bear in mind that my knowledge of Access is VERY limited. I've tried a search and don't understand about queries and such like. Even so I'd have thought that even the most basic database programmes would be able to handle something as simple as an alpha/numeric sort list....seems not!!!!!
????????????????
View 8 Replies
View Related
Mar 30, 2006
I have a table with two columns
skill and category
i need to write some type of query or report that will group the skills into the numerical categories 1-9 and then in each of those groups listthe skills autamaticall and then have a way to print it out either in word or excel looking some thing like this
category 1
askill
bskill
cskill
category 2
askill
bskill
cskill
.....
any ideas?
View 1 Replies
View Related
Feb 28, 2007
How can I sort string addresses so as to get the correct number order? I know that strings sort on each character, which causes the problem. I have tried some things (with VAL and Len), but was not completely successful. I do not want to enter an address number as 0630, when I want 630.
Why does this not work:IIf(Len(Str(Val([address]))=3),"0" & [address],[address])? Address has 3 and 4 numbers only.
View 2 Replies
View Related
Aug 9, 2007
I have a job database where I sort jobs by upcoming, inactive, closed and active. Each has a corresponding number 1-4 respectively. The main table I update the jobs in is the JOB TABLE. I print a weekly report for our weekly meeting but I only want the active jobs in the report. My question is: how do I perform a sort function in the query, so I will have only the active jobs in the database table show in the query? Thanks in advance! If more info is needed I wil post additonal.
View 4 Replies
View Related
Jan 23, 2006
Hey everyone,
Is there any way that you can do a secondary sort on a field?
Any help would be of great!
Thanks - edawson
View 2 Replies
View Related
Sep 1, 2006
Hi The beginner here again.....
How do I set a table to sort by specific fields???
ie i have an ID field which is an autonumber, then 6 fields
I want the table to autosort first by a field called [rank], and then by a field called [name]
Thanks in advance
Egg
View 8 Replies
View Related