473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Wrong sorting by query

Hello all,

When making a new table by running a make table query based on a
table,
the field I added a descending sort, is not always sorted correct.
When I run the query 10 times, almost 7 times it's sorted correct and
3 times incorrect.

Anyone who can help me with this 'bug' ??

Thanks in advance.
Nov 13 '05 #1
7 4328
What are you basing the incorrect sort on, opening the resulting table and
looking at its data? If so, don't. There is no guarantee about the order
data is stored in a table. If you need it in a certain order, use a query to
retrieve the data and sort in that query.

--
Wayne Morgan
MS Access MVP
"Geert Elias" <ge*********@plastal.com> wrote in message
news:bb**************************@posting.google.c om...
Hello all,

When making a new table by running a make table query based on a
table,
the field I added a descending sort, is not always sorted correct.
When I run the query 10 times, almost 7 times it's sorted correct and
3 times incorrect.

Anyone who can help me with this 'bug' ??

Thanks in advance.

Nov 13 '05 #2

Elias

If you are sorting the table by the column od char type which has
numbers, then you may get wrong sorting order. Can you post the result
you get?

Madhivanan

Nov 13 '05 #3
"Madhivanan" <ma************@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...

Elias

If you are sorting the table by the column od char type which has
numbers, then you may get wrong sorting order. Can you post the result
you get?

Madhivanan


No. Wayne is correct. The OP is hoping to "pre-sort" his tables. He will
NEVER have complete control over the order in which records appear in a
table. If he wants the records to appear in some particular order, he MUST
use a query. (That's what they're there for)

--
Randy Harris
(tech at promail dot com)

Nov 13 '05 #4

Indeed, I base my conclusion on the incorrect sorting on the result
table after running the query.

The column that has to be sorted in descending order is a DATE ( general
date ).
The problem is that I use this generated table as a base for a VBA
application that search data with the 'MoveNext' command (recordset).

Geert ELIAS

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #5
Geert Elias wrote:
The problem is that I use this generated table as a base for a VBA
application that search data with the 'MoveNext' command (recordset).


Then use a recordset based on the table.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #6
Then open the recordset using a query that is based on the table. You can
either define the SQL of the query in the code or used a stored query. You
don't have to open the recordset directly on the table. You can sort as
desired in the query, this will cause your recordset to be sorted.

Example:
strSQL = "SELECT * FROM Table1 ORDER BY Table1.DateField;"
Set rst = CurrentDb.OpenRecordset(strSQL)

or
Set rst = CurrentDb.OpenRecordset("NameOfQuery")

Add other parameters as needed.

--
Wayne Morgan
MS Access MVP
"Geert Elias" <ge*********@plastal.com> wrote in message
news:42********@127.0.0.1...

Indeed, I base my conclusion on the incorrect sorting on the result
table after running the query.

The column that has to be sorted in descending order is a DATE ( general
date ).
The problem is that I use this generated table as a base for a VBA
application that search data with the 'MoveNext' command (recordset).

Nov 13 '05 #7

Hello,

I rewrote the command so that my recordset is now based on a ( sorted )
query based on the table.
Now it works perfect !!!

Thanks to all for the quick response.

Kind regards

Geert ELIAS
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #8

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

Similar topics

4
by: Wm | last post by:
I have a query that I expect to return 3 or 4 entries -- but I seem to be getting only the most recent entry, repeated 4 times. What am I doing wrong here? $query="SELECT...
8
by: guitarromantic | last post by:
Hey, I have a 'staff' table with a column 'status', corresponding to a 'statuses' table with the appropriate titles (eg 1 | Editor in Chief). I want to display on the page the headings (the...
7
by: Not Me | last post by:
Hi, Having a table with some duplicate ID's (different data tho), how can I return the list but with only one record from each ID? Would this be using the first() function and grouping? ...
7
by: MLH | last post by:
?dcount("","qryOwnrsDueITSwMissingAddr") when run in the immediate window return a number greater than the number of rows that display when the saved query is run - opening in the database window?...
2
by: kkleung89 | last post by:
Basically, here's what's happening with the program. I have a table of Customers and a table of Pets, with the latter containing a field linking it to its customer of ownership. I have a form...
34
mkuberski
by: mkuberski | last post by:
I have a database with 3 tables, Mailing_List, All_Seminars and Proximity_Results. The Mailing_List is a list of customers and their address, All_Seminars is a list of seminar locations and the...
6
by: tom_b | last post by:
Hi, I'm using Mysql and PHP,I have a simple table in my DB, looks something like this: id jim bob bill 1 20 30 15 2 20 35 15 etc, what i need to do is get the sums...
14
by: gert | last post by:
Why does query = www ? int main(void) { char *user="www"; char *password=""; char *database="www"; char *query={"SHOW DATABASES;"}; db(user,password,database,query);
11
by: michaelperl | last post by:
hi all ! I need some help please I'm using a database tool for developing and driving dynamic content. With the tool I use I make queries based on my tables and I set the sorting order of my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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...

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.