UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Form Remembers Last Sort Order - How To Stop This, Access 2016    
 
   
daschrislydon
post Mar 14 2018, 08:16 AM
Post#1



Posts: 103
Joined: 28-August 15



Hello

This has bugged me on and off for years but I've never been that bothered to investigate what's actually going on with it.

If I set a continuous form sort order by, e.g., right clicking on a field and choosing Sort A-Z, then close the form, then re-open it, the sort order is what I set it as - but I want the form to reset to the default sort order.

This is in Access 2016.

I'm sure there's an easy explanation/solution...

(Tried searching forums but "sort order" tends to come up a lot, so hard to filter to actually the problem I'm having)

Thanks

Chris
Go to the top of the page
 
nuclear_nick
post Mar 14 2018, 08:27 AM
Post#2



Posts: 1,659
Joined: 5-February 06
From: Ohio, USA


What does the 'Order By' and 'Order By On Load' properties of the form say when you change the sort order?
Go to the top of the page
 
daschrislydon
post Mar 14 2018, 08:31 AM
Post#3



Posts: 103
Joined: 28-August 15



Well, after I choose the sort order, the OrderBy property shows the field that I've sorted by.
OrderByOnLoad is set to No.

(If I remove the OrderBy property and save the form, and reload it, obviously the sort order is as expected - whatever the Record Source is giving.)
Go to the top of the page
 
nuclear_nick
post Mar 14 2018, 08:57 AM
Post#4



Posts: 1,659
Joined: 5-February 06
From: Ohio, USA


What happens if, say, On Close of the form you blank out any changes to the Order By and Order On Load properties?

I think that may work...
Go to the top of the page
 
daschrislydon
post Mar 14 2018, 01:57 PM
Post#5



Posts: 103
Joined: 28-August 15



I could do that - I haven't tested to see if that works yet.

But having to do that on every form in case the user decides to right click and sort seems to be a bit poor....

I see this old post about it (14 years old!)

https://bytes.com/topic/access/answers/1918...rderby-sticking

They didn't come to a solid conclusion - apart from some Me.Orderby = "" / False in each form....
Go to the top of the page
 
daschrislydon
post Mar 16 2018, 05:52 AM
Post#6



Posts: 103
Joined: 28-August 15



Here's an irksome characteristic of this issue...

If I open a form, and discover that is has the previous manual sort order retained on int, and I click on the "remove sort" button on the toolbar - it removes the sort. Great.
But then I close the form and open it again, and the sort order I removed is back again!

Surely this is a thing that has happened to many many people - there must be a setting somewhere which is wrong....

(I have checked I'm not going mad - this doesn't happen on all forms. I have a project in Access 2010 that works just fine - I open a form, set some sort orders manually, close the form, and it opens as if I hadn't set any sort orders - just as I'd expect!)
Go to the top of the page
 
projecttoday
post Mar 16 2018, 06:33 AM
Post#7


UtterAccess VIP
Posts: 10,352
Joined: 10-February 04
From: South Charleston, WV


I did a test in Access 2013, deleting the sort manually, saving the form, closing the form, and then opening the form and it was gone. Where is this remove sort button?

Is this a db created since you moved to 2016 or have you done this in earlier versions?
Go to the top of the page
 
daschrislydon
post Mar 16 2018, 06:36 AM
Post#8



Posts: 103
Joined: 28-August 15



The remove sort button is in the Home tab, in the sort and filter section.

I can't quite remember the genesis of the particular database I'm working on that exhibits this behaviour.
Probably started as an Access 2003 db.

(The test I just did was in a file that was definitely started in Access 2010, so perhaps there is something in that....)
Go to the top of the page
 
projecttoday
post Mar 16 2018, 06:57 AM
Post#9


UtterAccess VIP
Posts: 10,352
Joined: 10-February 04
From: South Charleston, WV


I opened a db in design view, confirm that there is a table field entered in the order by property on the data tab, and I go to the home tab and I see that the remove sort button is greyed out. Strange. This is Access 2013.

Anyway, do you have an earlier version you can test it on? If not, post it here and I can test it in 2013. Or maybe somebody else can test it in an earlier version. As I noted, mine does allow me to remove the sort by deleting it manually from the property but my remove sort button doesn't seem to be active.

I may be gone for a couple of hours.
Go to the top of the page
 
daschrislydon
post Mar 19 2018, 06:52 PM
Post#10



Posts: 103
Joined: 28-August 15



I have access to Access 2010, so at some point I'll try it in that to see what happens.

For now, I've discovered that if I put the following in the Form Deactivate event procedure, then it clears the sort order:

CODE
Me.OrderBy = vbNullString
Me.OrderByOn = False

Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    12th December 2018 - 10:06 AM