Sort not holding (1 Viewer)

Tina49

Registered User.
Local time
Today, 03:54
Joined
Sep 29, 2011
Messages
34
I have a an unbound field that allows me to search for an employee. I would like the drop down list to be alphbetized, however, it doesn't hold the sort. I have completed the following steps.

1. Right clicked on the unbound field
2. Selected property sheet
3. Selected row source (which brings up the query)
4. Query is by EmpID FirstName Last Name
5. Set Last name to sort by alpha
6. Put Last name as the first field

Every time I use the list it is in the original table order. It won't hold the sort or any changes I make within this query. Any ideas?

Thanks in advanced for your help
 

JHB

Have been here a while
Local time
Today, 12:54
Joined
Jun 17, 2012
Messages
7,732
Show your query string.
 

Tina49

Registered User.
Local time
Today, 03:54
Joined
Sep 29, 2011
Messages
34
This is my SQL that I have tried to save, over and over again.
SELECT Employees.EmployeeID, Employees.LastName, Employees.FirstName
FROM Employees
ORDER BY Employees.LastName;

This is what it reverts back to
SELECT Employees.EmployeeID, Employees.LastName, Employees.FirstName
FROM Employees
 

JHB

Have been here a while
Local time
Today, 12:54
Joined
Jun 17, 2012
Messages
7,732
Hmm - do you have some code running, that change the row source for the combo box?
Try by putting in the query string directly in the row source.
Else try creating a new form and putting a combo box at it, with the same row source, to see if it make any differences.
Else post you database with some sample data.
I just saw, Employees.LastName isn't the first field as you told it the first post, then it has to be so:
SELECT Employees.LastName, Employees.FirstName, Employees.EmployeeID
FROM Employees
ORDER BY Employees.LastName;
But never mind about that!
 

Tina49

Registered User.
Local time
Today, 03:54
Joined
Sep 29, 2011
Messages
34
That is because it is not holding the sort. I just pasted my last attempt in. I have tried putting Last Name first, but the query simply doesn't hold. Is this an issue perhaps when trying to change the query of an unbound field? This only happens when I try and change a query of an unbound field, not if I create a new unbound field with a new query. It also shouldn't matter whether I have Last Name first or last if I have it sorted on that field. Now I can recreate the field and query, but I am wondering why this happens.
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:54
Joined
Jan 23, 2006
Messages
15,379
it doesn't hold the sort.

What exactly doesn't hold the sort???

A SELECT query reads data from your table(s). It doesn't change anything. It is simply a read operation, and if you include an ORDER BY clause, it will perform the Ordering.

I yo save the query with a name and repeat the query, it should give you the same result time and again.

Perhaps you could show us some data in your table,; the result o the query execution; and what you think should happen but doesn't.

Good luck.
 

Tina49

Registered User.
Local time
Today, 03:54
Joined
Sep 29, 2011
Messages
34
It doesn't hold the sort.

This is my SQL that I have tried to save, over and over again.
SELECT Employees.EmployeeID, Employees.LastName, Employees.FirstName
FROM Employees
ORDER BY Employees.LastName;

This is what it reverts back to
SELECT Employees.EmployeeID, Employees.LastName, Employees.FirstName
FROM Employees

So I save the query with the sort by last name. I close the query. I run the query. No sort performed. I open up the query and it has reverted back to the above SQL
 

jdraw

Super Moderator
Staff member
Local time
Today, 06:54
Joined
Jan 23, 2006
Messages
15,379
Please post a copy of your database - no confidential info.

Is it possible you are opening the database in Read Only mode?
 

Users who are viewing this thread

Top Bottom