473,671 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sorting multiple fields in queries

I am so aggravated and need any help I can get. I am using Access 2000
and am trying to sort multiple fields in a select query.

My query is set up as follows:
FIELD 1 FIELD 2 FIELD 3 FIELD4 FIELD 5 FIELD 6
MSA03 MSA 02 % change ICU 03 ICU 02 % change
calc. calc.

This format continues and in some queries I have up to 13 percentages
to sort. I need to sort each percentage to show over 20% increase and
have only those records with an increase show.

I've tried using >=.2 as the criteria in each percentage field, but
that doesn't give me what I need.

(I know this looks like it should have been done in Excel, but for
reporting/printing purposes it had to be done in Access.)

Any help is greatly appreciated.
Thank you

Nov 13 '05 #1
3 3466
Tesc,
Behind the scenes the QBE grid is writing an SQL statement for you. To
define the sort order of a query it uses (and you can use) an ORDER BY
clause in the SELECT statement. If you want to limit the rows returned in a
result to only those that meet a set of criteria, then you would include a
WHERE clause.
So, for example, "SELECT [FIELD 1], [FIELD 2], [FIELD 3], [FIELD4], [FIELD
5], [FIELD 6] FROM TABLE1 WHERE [FIELD 1] >=0.2 OR [FIELD 2] >= 0.2 OR
[FIELD 3] >=0.2 OR [FIELD 4] >=0.2 OR [FIELD 5] >=0.2 OR [FIELD 6] >=0.2
ORDER BY [FIELD 1].

And a gripe--Naming your fields [FIELD 1], [FIELD 2], etc. is lazy & rude.
Hopefully no one else has to use the table set up this way. Hopefully the
table won't be in service long enough for you to forget what each field
contains. But bitter experience by many database administrators has taught
that failing to make the effort to name fields something sensible begets
hours of hair pulling and teeth gnashing by the users and administrators of
such a database. Make the effort to name your fields.

<te**@optonline .net> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
I am so aggravated and need any help I can get. I am using Access 2000
and am trying to sort multiple fields in a select query.

My query is set up as follows:
FIELD 1 FIELD 2 FIELD 3 FIELD4 FIELD 5 FIELD 6
MSA03 MSA 02 % change ICU 03 ICU 02 % change
calc. calc.

This format continues and in some queries I have up to 13 percentages
to sort. I need to sort each percentage to show over 20% increase and
have only those records with an increase show.

I've tried using >=.2 as the criteria in each percentage field, but
that doesn't give me what I need.

(I know this looks like it should have been done in Excel, but for
reporting/printing purposes it had to be done in Access.)

Any help is greatly appreciated.
Thank you

Nov 13 '05 #2
Thank you for your response and the spanking. My fields are named
properly. I listed field names and numbers for illustrative purposes
only.

Nov 13 '05 #3
Thank you for your response. My fields are named properly, MSA 03, MSA
02, MSAPCT and so on. I included the field numbers for illustrative
purposes only.

Thanks again.

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2982
by: Paul Kirby | last post by:
Hello All I am trying to update me code to use arrays to store a group of information and I have come up with a problem sorting the multiple array :( Array trying to sort: (7 arrays put into an array) and I want to sort on Descending. This is displayed using print_r() function. Array
3
7747
by: Gord | last post by:
I would like to create a summary report from the results of 11 queries (based on 2 tables). All the queries have the same format and return 3 numbers (Count, Current Year Bal, Last Year Bal.) under different conditions. When I use the Report Wizard to select multiple queries to be included in my report, I got an error msg. It says "You have chosen fields from record sources which the wizard can't connect. You may have chosen fields...
8
3511
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At the moment the printed output is usually going to Word. It's turning into an unholy mess, because I'm having to prepare umpteen different Word templates, and the queries that drive them, depending on what events a course has.
3
35452
by: alex_peri | last post by:
Hello All, I am having problems with sorting a recordset by fields in Access. I have a table with three columns called ID, SNo and Time and would like to sort the records by Time. I would like to sort them in the actual database and not just Order them with SQL. I have included the code I wrote below. Please bear in mind that I am very new to Access and SQL. I used the Helpfile of Access for this code but i can't make it work for me....
0
8773
by: MHenry | last post by:
Hi, I know virtually nothing about creating Macros in Access. I would appreciate some help in creating a Macro or Macros that automatically run(s) 14 Queries (three Make Table Queries, and 11 Append Queries) when the Database is first opened, and then again anytime I invoke the Macro (somehow) after the database is already open. The latter function is useful, because the queries must be rerun every time data is added, deleted, or...
2
1379
by: Tarvos{k} | last post by:
Okay folks, I am back with another somewhat weird problem. I have a table that I am trying to run a query on that has the following fields: City, State, Zip Code, Population, Households. The info for the table came from US Census information for 2000, and what I need is to find the number of times a particular entry repeats. Example: I want to find the number of times a city name shows up, and the number of states it shows up in.
11
4517
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my database,just help in getting me pointed in the right direction. I have a database with 8 tables, which from what I have read, cannot be linked on a single form, and be updatable. I have created a query which includes all 8 tables, and then...
3
4030
by: Neil Hindry | last post by:
I wonder if you can help me. I have setup an address-book database in Access XP. I have the first name & surname as separate fields. As I wanted to sort my database by surname and then by first name I had surname before first name when I created the fields of my database.. To do the sort (in table view) I highlighted the two columns (fields), in this case surname and first name, and selected sort. Access then sorted the database by...
8
4611
by: Chris A via AccessMonster.com | last post by:
I have an interesting problem that I have yet to come accross that I can't change data structure on because it is an export from filemaker I am reformatting for another dept. anyway. I have a table like so... Table 1 Field1 Field2 Field3 E1 April 2006 AA, BB, CC E2 April 2006 AA, BB, CC,DD, EE E3 April 2006 AA, BB
0
8924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8823
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8672
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6234
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.