473,406 Members | 2,439 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,406 software developers and data experts.

Sorting Problem

I am having a sorting problem on a form. No subforms.
Continuous Page Main Form. The query works fine pulling up a datasheet
but when I attach it to a button on a form. It brings up today's
records but does not sort.

What do I need to change.

Here is the code for the query.

SELECT MAIN.DATE1, MAIN.WORKER, MAIN.TIME
FROM MAIN
WHERE (((MAIN.DATE1)=Date()))
ORDER BY MAIN.DATE1, MAIN.WORKER, MAIN.TIME;

Thanks for any help..............

Nov 13 '05 #1
5 1609
Randy,
What about:
SELECT MAIN.TIME, MAIN.WORKER
FROM MAIN
WHERE (((MAIN.DATE1)=Date()))
ORDER BY MAIN.TIME, MAIN.WORKER;

Sorting by date when the only date requested is today is redundant. If the
preferred sort is time then worker, then what I gave you should work.
--
Alan Webb
kn*******@SPAMhotmail.com
"It's not IT, it's IS"

"Randy" <ra****@msn.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
I am having a sorting problem on a form. No subforms.
Continuous Page Main Form. The query works fine pulling up a datasheet
but when I attach it to a button on a form. It brings up today's
records but does not sort.

What do I need to change.

Here is the code for the query.

SELECT MAIN.DATE1, MAIN.WORKER, MAIN.TIME
FROM MAIN
WHERE (((MAIN.DATE1)=Date()))
ORDER BY MAIN.DATE1, MAIN.WORKER, MAIN.TIME;

Thanks for any help..............

Nov 13 '05 #2
I tried it your way also but it is not sorting either by worker or
time, time or worker. I took out the sort by Date1. For some reason
it will bring up the today's date but refuses to sort the other two
fields. I can do it manually from the filter button and it works fine,
but if I attach it to a button on the form all it brings up is todays
records with no other sorts...??? its baffling me. The query works
fine on a datasheet.

Can you think of anything else?

Nov 13 '05 #3
Randy,
This makes me wonder about the underlying data. I am curious as to what the
declared data type is for the column you want to sort on and whether it is
declared as a date, text, or . . .? Another thing to try is to declare an
index on the table that supplies the data which has the sort you want. Data
entry speed suffers as a result of this, but that may or may not be an issue
depending on whether this is a table used primarily for data capture or for
reporting & presentation of data.

Date serials will sort differently than dates stored as text in some cases.
A date stored as text could sort like this:
1/11/2001
11/1/2001
12/1/2001
2/1/2001

While you would expect:
1/11/2001
2/11/2001
11/1/2001
12/1/2001

So, I wonder about how the data is stored and whether that might lead to an
answer?
--
Alan Webb
kn*******@SPAMhotmail.com
"It's not IT, it's IS"

"Randy" <ra****@msn.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
I tried it your way also but it is not sorting either by worker or
time, time or worker. I took out the sort by Date1. For some reason
it will bring up the today's date but refuses to sort the other two
fields. I can do it manually from the filter button and it works fine,
but if I attach it to a button on the form all it brings up is todays
records with no other sorts...??? its baffling me. The query works
fine on a datasheet.

Can you think of anything else?

Nov 13 '05 #4
I had imported the data so that may be the problem. I think you have
hit the nail on the head.

What do I need to do to fix this? I am new and just learning Access.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 13 '05 #5
Randy,
Look at the table that contains the imported data in design view and see
what the data type of the column you want to sort is. If it isn't
Date/Time, then it won't sort the way you expect. Don't immediately change
it though, there may be some of the data that doesn't translate to what
Access understands to be a valid date. If there is some data in there that
won't cleanly convert to a valid date (a clerk entered "time:
2004:02:23:18:22:03:50" instead of #2/23/2004 18:22:03:50#.) then Access
will change it to text and leave it for you to figure out what happened.
Once you've found all the data that doesn't convert to dates properly and
decided to either change it or add a column with the change and change it in
the new column (better for preserving an audit trail) then you can fix the
bad data and convert the column to Date/Time and you should be fine after
that.
--
Alan Webb
kn*******@SPAMhotmail.com
"It's not IT, it's IS"

"Randy McCall" <ra****@msn.com> wrote in message
news:du***************@news.uswest.net...
I had imported the data so that may be the problem. I think you have
hit the nail on the head.

What do I need to do to fix this? I am new and just learning Access.

*** Sent via Developersdex http://www.developersdex.com ***

Nov 13 '05 #6

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

Similar topics

4
by: dont bother | last post by:
This is really driving me crazy. I have a dictionary feature_vectors{}. I try to sort its keys using #apply sorting on feature_vectors sorted_feature_vector=feature_vectors.keys()...
9
by: jwedel_stolo | last post by:
Hi I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table I have used two methods in order to determine the sort order of the...
7
by: Federico G. Babelis | last post by:
Hi All: I have this line of code, but the syntax check in VB.NET 2003 and also in VB.NET 2005 Beta 2 shows as unknown: Dim local4 As Byte Fixed(local4 = AddressOf dest(offset)) ...
4
by: John Bullock | last post by:
Hello, I am at wit's end with an array sorting problem. I have a simple table-sorting function which must, at times, sort on columns that include entries with nothing but a space (@nbsp;). I...
4
by: FBM | last post by:
Hi, I am working on a program that simulates one of the elements of ATM. The simulation stores events which occurs every some milliseconds for a certain amount of time. Every time that an event...
4
by: Ambica Jain | last post by:
Hi, I want custom sorting on some of the columns in the datagrid. And i am able to do the same by overriding MouseDown event. However, i need to rebind my datatable to reflect the changes in...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
1
by: Ahmed Yasser | last post by:
Hi all, i have a problem with the datagridview sorting, the problem is a bit complicated so i hope i can describe in the following steps: 1. i have a datagridview with two columns...
1
KevinADC
by: KevinADC | last post by:
Introduction In part one we discussed the default sort function. In part two we will discuss more advanced techniques you can use to sort data. Some of the techniques might introduce unfamiliar...
7
Plater
by: Plater | last post by:
I am having trouble determining when my DataGridView object is sorting (based on a column header click). The idea is, in a large table, sorting the columns takes time, so I show a splash screen....
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.