Allowing Temporary Sorting

W

Williams

I have a form that I always want to appear with the records displayed in sort
order. The end users may sort the data by any column desired, but whenever
the form is displayed I want it to open up with the records sorted by Date.
The form is based upon a query which identified that the DATE field should be
sorted in Ascending order. The properties of the form have also been
updated to reflect that the records should be "Ordered by" DATE.

Whenever a user opens the form and sorts by an alternate field the form
retains the sort order of the last user even though the form does not request
to save the layout changes. How can I prevent this from happening?
 
F

fredg

I have a form that I always want to appear with the records displayed in sort
order. The end users may sort the data by any column desired, but whenever
the form is displayed I want it to open up with the records sorted by Date.
The form is based upon a query which identified that the DATE field should be
sorted in Ascending order. The properties of the form have also been
updated to reflect that the records should be "Ordered by" DATE.

Whenever a user opens the form and sorts by an alternate field the form
retains the sort order of the last user even though the form does not request
to save the layout changes. How can I prevent this from happening?

The Form's recordsource is a query ordered by the [DateField]?
Turn off the Form's OrderByOn property in the Form's Load event.

Me.OrderByOn = False

The query's sort will appear on the form.
When the user changes the sort the OrderByOn property will be set to
True until the next time the form is opened or the user right-clicks
on the form and selects Remove Filter/Sort.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top