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;
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?
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?
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.
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??
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?
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?
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)?
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.
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?
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
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:
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.
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.
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.
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?
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...
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.