Sort Not Working- ARRRGGGHH

Aug 8, 2007

Hi guys,


I got a weird problem. trying to bring back data from my database, i have a query that has worked for the last year perfectly. today, its not. Im asking it to sort via several fields, first is the state, second is the suburb. so what i should (and have) ended up with is a list of states and suburbs in alphabetical order, grouped by state. all of a sudden, W comes before G which comes before A. wtf?

the SQL is quite big as it joins several tables, but the order clause is this:
"ORDER BY States.Description, public_publications.mLocation, public_publications.title, PublishingDays.OrderLevel, [ABC-Circulation].iYear DESC , [ABC-Circulation].AuditPeriod DESC;"

States.Description = Name of state
public_publications.mLocation = suburb
public_publications.title = title of publication
PublishingDays.OrderLevel = special order level (applys only when one publication has more than one entry)
year and auditperiod are the year and the period of the year that the audit takes.

even if i take out all the sorting and leave in "public_publications.mLocation" it still thinks that G comes first, then W, then B, then F etc etc. ARGGGHHGH

is there anything else that effects sorting? this is driving me CRAZY!!!!!!!!

i have compacted and repaired. I have copied the SQL, re-wrote it from scratch, removed all ordering, nothing works.

again i will say that this worked 100% right 3 months ago (last time i used the query) - and i have not changed the query (at least i dont remember doing it, and i have not had a reason to change it). hence why im going insane.


:mad:

SELECT
PublicationTypes.tPublicationType,
[ABC-PublicationSubTypes].tDescription,
public_publications.title,
IIf([Exclusions],'*' & [Issues],[Issues]) AS NumOfIssues,
IIf([ABC-Circulation].[DayPublished]=20,[SpecialPublishingDay],[PublishingDays].[DayPublished]) AS Days_Published,
[ABC-Circulation].CoverPrice,
IIf(IsNull([ABC-Circulation].[CoverPriceDay]),[PublishingDays].[DayPublished],IIf([ABC-Circulation].[CoverPriceDay]=20,[SpecialPublishingDay],PublishingDays_1.DayPublished)) AS CoverPriceDay,
[ABC-Circulation].CoverPrice2,
IIf([ABC-Circulation].[CoverPrice2Day]=20,[SpecialPublishingDay],PublishingDays_2.DayPublished) AS CoverPrice2Day,
[ABC-Circulation].CoverPrice3,
IIf([ABC-Circulation].[CoverPrice3Day]=20,[SpecialPublishingDay],PublishingDays_3.DayPublished) AS CoverPrice3Day,
AuditTypesMaster.AuditType, Format([dStartDate],"mmm") & " to " & Format([dEndDate],"mmm") & " " & [ABC-Circulation].[iYear] AS Period,
IIf([InExcess],[Australia] & "+",[Australia]) AS ANPS,
[ABC-Circulation].inclAccomAirlineSales,
[ABC-Circulation].inclEducationalSales,
[ABC-Circulation].inclEventSales,
[ABC-Circulation].inclMultiplePublicationSales,
IIf([NZInExcess],[NewZealand] & "+",[NewZealand]) AS NewZealandFigures,
IIf([OCInExcess],[OtherCountries] & "+",[OtherCountries]) AS OCFigures,
IIf([exclInExcess],[exclAustraliaOther] & "+",[exclAustraliaOther]) AS exclAUSFigures,
IIf([Exclusions],[ExcludedDates],Null) AS Remarks1,
[ABC-Circulation].BumperIssues,
[ABC-Circulation].BumperIssueDates,
PublishingDays.OrderLevel,
public_publications.mLocation,
public_publications.CompanyID,
States.Description,
PublishingDays.OrderLevel,
[ABC-Circulation].iYear,
[ABC-Circulation].AuditPeriod
FROM ((((AuditTypesMaster
INNER JOIN ((((([ABC-Circulation]
INNER JOIN public_publications ON [ABC-Circulation].PubID = public_publications.Pubid)
LEFT JOIN PublishingDays ON [ABC-Circulation].DayPublished = PublishingDays.lDayIndex)
LEFT JOIN PublishingDays AS PublishingDays_1 ON [ABC-Circulation].CoverPriceDay = PublishingDays_1.lDayIndex)
LEFT JOIN PublishingDays AS PublishingDays_2 ON [ABC-Circulation].CoverPrice2Day = PublishingDays_2.lDayIndex)
LEFT JOIN PublishingDays AS PublishingDays_3 ON [ABC-Circulation].CoverPrice3Day = PublishingDays_3.lDayIndex)
ON AuditTypesMaster.iIndex = [ABC-Circulation].lAuditType)
LEFT JOIN PublicationTypes ON public_publications.lPublicationType = PublicationTypes.lIndex)
LEFT JOIN [ABC-PublicationSubTypes] ON public_publications.lPublicationSubType = [ABC-PublicationSubTypes].lSubTypeIndex)
LEFT JOIN [ABC-AuditPeriods] ON [ABC-Circulation].AuditPeriod = [ABC-AuditPeriods].lAuditPeriodID)
INNER JOIN States
ON public_publications.state = States.StateID
WHERE (((Format([dStartDate],"mmm") & " to " & Format([dEndDate],"mmm") & " " & [ABC-Circulation].[iYear])="Jan to Jun 2007"
Or (Format([dStartDate],"mmm") & " to " & Format([dEndDate],"mmm") & " " & [ABC-Circulation].[iYear])="Jul to Dec 2006"
Or (Format([dStartDate],"mmm") & " to " & Format([dEndDate],"mmm") & " " & [ABC-Circulation].[iYear])="Apr to Jun 2007"
Or (Format([dStartDate],"mmm") & " to " & Format([dEndDate],"mmm") & " " & [ABC-Circulation].[iYear])="Jan to Mar 2007"
Or (Format([dStartDate],"mmm") & " to " & Format([dEndDate],"mmm") & " " & [ABC-Circulation].[iYear])="Oct to Dec 2006")
AND ((public_publications.lPublicationType)=5))
ORDER BY
public_publications.lPublicationType,
States.Description,
public_publications.mLocation,
public_publications.title,
public_publications.CompanyID,
PublishingDays.OrderLevel,
[ABC-Circulation].iYear DESC ,
[ABC-Circulation].AuditPeriod DESC;

View Replies


ADVERTISEMENT

Sort Not Working (Ascending)

Feb 24, 2005

Goodday All

I am having a bit of a problem with one of my tables. I am using VBA code to add data to one of my tables, my problem is that even when I manually sort the table, it still gives me problem.

For example, I have a table that stores mobile numbers by year and month. I manually sort it by year- Ascending, but it still gives me this jumbled up table. I even tried writing a query to pull out the data and set the Sort by ascending and yet still it gives me this. What am I doing wrong?


MobileNo YearMonthRental Fees
+27241214282004Dec0.0089.60
+27245873742004Dec0.00607.89
+27256801612004Dec0.00607.89
+27245998662005Feb0.00246.00
+27246790232005Feb0.00246.49
+27249275562005Feb0.00335.96
+27278115852005Jan0.00782.04
+27249442532005Jan0.00357.40
+27278100662005Jan0.00137.70


Thanx for all the help

Kind Regards

View 13 Replies View Related

Report Sort Different From Query Sort

Mar 3, 2006

i made a report based on a query. when i run the query, my results are sorted by Job Time Ascending, like i want...
when i made my report i chose job id as the main group priority in the wizard..

now in my report it displays the jobs in ID ascending, rather than Job time ascending as my query says..

i dont want to re-do the report it took ages.. how can i fix this?

View 3 Replies View Related

Can I Do A Sort Within A Sort On Combo Boxes?

Oct 16, 2006

Hi all,

I have a form in Access 2K that properly displays city, state and zip codes. As I type in each letter of a city's name into the combo box, I get the first city in the sorted list displayed (autofills). That's fine when there is only one zip code for a city, but when I enter "chic" for chicago I still get the first chicago zip code in my table.

It sure would be nice if I could do a "sort within a sort" so that if there were two or more records with the same city name then that whole group would drop down so I could choose one of the other zip codes. If this is doable, kindly point me to an example as I need all the help I can get.

Thanks in advance for any responses.

D

View 6 Replies View Related

Report Sort Is Not The Same As Query Sort...

Jan 9, 2005

I have a query that sorts players batting averages from highest to lowest. When I run the query just by itself it sorts it right however when I open the report based on that query it does not sort in descending order like I asked. What am I missing??

View 3 Replies View Related

Program Working In Access 2007 Not Working In Access 2010 Due To Missing OCX File

Dec 27, 2014

I have a program that runs under access 2007 that I use at my work. We will soon be updating to MS office 2010 and the program will not work now because a calender file .ocx was removed from access 2010. Is there a way to get the 2007 .ocx file to work in access 2010?The program I am using is a relatively simple stand-alone and unsupported app that we use to request patient arrival and departure from various radiology tests inside a hospital. No reports are made from the app other than the number of patient transports for the day.

The app is placed on a common drive accessed from any pc in the hospital. No special permissions are required. But our app does use the calendar, time and date functions in access 2007. When I tried the app on a pc with access 2010, it basically says it (access) cannot open the app because a .ocx file is not present.Is there a way to make the access 2010 calendar file work in access 2007?

View 1 Replies View Related

Duplicate Record Command Button Not Working For One Form But Is Working For Other Form

Jan 15, 2015

I have an Access 2010 database with two tables and two forms. The tables are Organizations and People. Similarly, the forms are Organizations Entry Form and PeopleEntryForm. The People are linked to the Organizations table. Several people can be linked to the same organization.On my Organizations EntryForm, I created a command button to duplicate a record using the wizard. It works fine.

I did exactly the same thing on the PeopleEntryForm, but instead of copying the record, it creates a new blank record. I don't get any error messages. Is my problem due to the fact that the People table is linked to the Organizations table?

View 13 Replies View Related

Sort By A Value

Aug 8, 2005

I was just wondering if it was possible to run a query by a specific value first, then the remainder of the following values in ascending order.

For example, the data would appear in the table as

Smith
Bloggs
Jones
Taylor

What I would like to do is have all the Taylors at the top, followed by Bloggs,Jones then Taylor

I have looked at the OrderBy function, but believe that you can only sort Ascending and Descending

Checked search, cant find anything

Many Thanks

Andy

View 3 Replies View Related

Re-sort

Mar 25, 2007

Hi,

I try to do something but I don't know how.
I have 1 table with 3 rows (title, year, genre) and 1 Form.
Is it possible to create combobox or something with 3 criterium, when I selected
criterium to re-sort columns in Forms (by title, by year, by genre)?

thank you

View 2 Replies View Related

Sort Asc / Dec

Jan 13, 2006

Continuous form:
The standard menu / toolbar commands sort ASC and DEC work just fine.
However, if I define a button with the VBCode
"DoCmd.RunCommand acCmdSortAscending", I get an alarm message pop-up
saying "the command or action "SortAscending" isn't available now".
I made sure that the standard menu items "Sort asc / dec" are not grayed out(disabled) at the time I click the button in runtime. The mouse cursor points to the desired sort criteria field.

Any advice?

Regards from Belgium (pretty cold here)

View 2 Replies View Related

How To Sort By IP Address

Aug 29, 2005

I am completely stumped on this one. I have a database where we track IP Addresses and I just want to sort by IP...should be simple, I'd think.

With these 5 IP's, I'd want them in this order:
1.2.3.1
1.2.3.4
1.2.3.7
1.2.3.9
1.2.3.10
1.2.3.17
1.2.3.21

But it sorts in this order:
1.2.3.1
1.2.3.10
1.2.3.17
1.2.3.21
1.2.3.4
1.2.3.7
1.2.3.9

Is there anything I can do to fix this? I want it to see each number as a whole, for example "10" instead of "1" and "0"

Much thanks.

View 5 Replies View Related

Sort Order

Oct 10, 2005

How do you change a file's sort order from ascii to international?

View 3 Replies View Related

Sort Table

Dec 22, 2005

Hello all...
I have a table which includes month, day & date. I want to sort this table by day, and then by month & then by year... does anyone know how to do this?

Thank you...:)

View 4 Replies View Related

Help Newbie Sort Out His DB

Jan 16, 2006

Hello all

Been looking at this forum for a few weeks and think it's great!!

Now for my first post :rolleyes:

We have a DB at work (attached) and it was put together by a consultant would you believe. Anyway I have been given the task to fix this. It now work i.e. it records what I want. The only problem is that it's written with more macros than i've ever seen.

I want some advice on the DB to make it function better. It is used to record how long a member of staff spend on a piece of work, apologies for the interface.

1. The user must first input a date , start date and end date into a table. Now the start date will always be a Monday and the end date a Sunday. Is there anyway to automate that process? i.e if a user goes in on a Monday the prevous weeks date is there but if the user went in before it would not , get the idea.

Anyway, please rip it to shreads and give me some advice

Thanks

View 11 Replies View Related

Auto Sort Anyone

Jan 25, 2006

I have a table already set up in a Subform of a main form

The Table has values like
-Date
-Time
-Name
-SchBy

I want to have the subforms table to automatically re-sort ascending by Time, how would I go about doing this so the user doesn't have to click the field then sort ascending button...?:confused:

View 1 Replies View Related

Hello, Sort Anoob Here

Oct 17, 2006

hello ladies and gents!
I've been kind of lurking around.
I love this site! thanks for having me :)

View 1 Replies View Related

Sort Negative First

Jan 15, 2007

When i sort values, for some reason the negatives are at the top, followed by the highest positive values. Anyway to turn this off?
Tried google and searching these forums.

View 5 Replies View Related

MDB To TXT Looses Sort

Dec 9, 2007

Hi all.
I imported a text file into a new table.
I sorted the table on one field, then exported table to another text file.
But, the sort did not export. The new text file has the same sort as the original.
What am I doing wrong?
Thanks.

View 3 Replies View Related

Sort Date

Dec 13, 2007

Hey all, I looked throught a couple of threads for sorting, but could not find exactly what I need.

Basically, I have a list of dates:

10-Aug-07
20-Oct-07
13-Nov-07
etc...

and when I try and sort these dates from earliest to latest, it only reads the number and not the month, like:

10-Aug-07
13-Nov-07
20-Oct-07
etc...

How would I make it sort by date and month?

Thanks,
RR

View 4 Replies View Related

Sort By Month

Jun 21, 2005

Hello, I have the following query which gives me a count by day.

However, it sorts by day instead of day/month.
For example:

01/01/05
01/02/05
01/03/05
02/01/05
02/02/05 and so on...

Can I sort so it will show me all of January, then all of Febuary etc?

Thanks.

J.

View 5 Replies View Related

Sort By First 2 Digits Only

Jan 19, 2006

Open the database – then open the Report: rep_Billing

I have a query that is doing some sort and count functions. The column [TYPE] is sorted then counted. Instead of sorting by the full name can the query sort based off of the first 2 characters?

Example:
On the report the first company is: AMERICAN POSTCARDS

First it separates the colors, which is good.
Then separates the [TYPE] then counts the total amount that color was that type.
However I do not want the full type to be separated out, I want it based on the first 2 characters so that the “N-“ will all stay together as a group.

Final count should say: AMERICAN POSTCARDS
GREEN RA 3
RED N- 14
RED PR 16
RED RA 12
BLUE NC 1

I know I can get this info from the report, but it has to be done at the query level because it is going to be exported into another system at that point. Thanks.

Let me know if I need to make this clearer. Thank you all.

Travis

View 2 Replies View Related

Sort By Last Entry

Feb 3, 2006

Hello,

Is there any way to sort a query by last entry? Unfortunately, this would be the only solution to a design error. Thanks much.

Pat

View 1 Replies View Related

Sort By Last Entry

Feb 3, 2006

Is there any way to sort a query by last entry? Unfortunately, this would be the only solution to a design error.

View 5 Replies View Related

Sort Problem

Feb 10, 2006

I need to sort an address field by street name only. The address info is stored as: 123 Main Street, etc. Is there a way to omit the number portion of the field during a sort function in Design View?

View 1 Replies View Related

Using The IIF Statement To Sort

May 2, 2006

Hi I have very basic SQL knowledge and would appreciate any help.

I have a query which asks users to enter an ID - based on that ID, a Report is generated that gathers student information and produces a subject report for that student. The ID refers to a subject that a particular student is enrolled in. The table that is returned contains a list of every student currently enrolled in that subject (which is what I want), however it is sorted alphabetically.

I want the result set to be sorted alphabetically, but within classes, where a class is a set of about 20 or 30 kids enrolled in a particular subject. So for example - If the ID for Maths 101 is 50. The user types in 50 at the message box promt, and the query returns 150 kids enrolled in Maths 101. But there are 5 class groups in Maths 101. So I need it to be sorted into Maths A, Maths B, Maths C, Maths D and Maths E, and then Alphabetically within each group.

The original student data is stored in a table that has about ten "lines" where a maths class may fall on the school time table. So it searches through Line A, and if ID=50 is not in Line A it searches Line B and so on.

How can I say in SQL "If the ID is in Line A, sort alphabetically by Line A, else If the ID is in Line B, sort alphabetically by Line B else...for 10 possible Lines"

I'd appreciate any help. I also need actual Sytax for how to put the IFF into my SQL window as I am not sure how to do this...

thanks heaps!!!!

Bella

View 3 Replies View Related

Date Sort

Jun 14, 2007

Hello,

Quick question,

I am bringing in two fields into a table which looks like this:

Field 1 Field 2
A 2006-07-25
A 2006-08-21
A 2006-09-21
A 2006-10-21

This is how it's sorted and do not forget that field 2 is a text field.

Now i made two different queries pulling in both Field 1 and Field 2, however in one query i'm pulling in First of Field 2 and in the second query Last of Field 2. For some reason, i'm getting 2006-10-21 as a first and 2006-07-25 as last.

Can anyone explain that?

Thank you!

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved