If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Set Order by
Can anyone tell me how to set the order by of a form when it opens?
I created a form with an order by; users change it and the form keeps the new order which causes problems when the form is opened the next time in the wrong order. |
#2
|
|||
|
|||
Set Order by
On Sun, 11 Jul 2004 21:21:40 -0400, "Berny"
wrote: Can anyone tell me how to set the order by of a form when it opens? I created a form with an order by; users change it and the form keeps the new order which causes problems when the form is opened the next time in the wrong order. Assuming that your order is set in the Record Source, then just set the OrderBy to an empty string. (By default Access keeps the last order set) Private Sub Form_Open(Cancel As Integer) Me.OrderBy = "" End Sub If you want to set an order on open. Private Sub Form_Open(Cancel As Integer) Me.OrderBy = "SomeField" Me.OrderByOn = True End Sub - Jim |
#3
|
|||
|
|||
Set Order by
Are you allowing the users to change the *design* of the Form?
This is not recommended in fully developed databases. -- HTH Van T. Dinh MVP (Access) "Berny" wrote in message ... Can anyone tell me how to set the order by of a form when it opens? I created a form with an order by; users change it and the form keeps the new order which causes problems when the form is opened the next time in the wrong order. |
#4
|
|||
|
|||
Set Order by
"Van T. Dinh" wrote in
message Are you allowing the users to change the *design* of the Form? This is not recommended in fully developed databases. "Berny" wrote in message ... Can anyone tell me how to set the order by of a form when it opens? I created a form with an order by; users change it and the form keeps the new order which causes problems when the form is opened the next time in the wrong order. But Van, you can't stop the users from clicking the "Sort Ascending/Descending" toolbar buttons unless you modify or replace that toolbar. When they do that, the form's OrderBy property is set, and saved when the form is closed. All you can do to prevent it is clear that property or set it yourself when the form is opened. -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#5
|
|||
|
|||
Set Order by
"Van T. Dinh" wrote
Are you allowing the users to change the *design* of the Form? This is not recommended in fully developed databases. "Berny" wrote Can anyone tell me how to set the order by of a form when it opens? I created a form with an order by; users change it and the form keeps the new order which causes problems when the form is opened the next time in the wrong order. Dirk Goldgar wrote: But Van, you can't stop the users from clicking the "Sort Ascending/Descending" toolbar buttons unless you modify or replace that toolbar. When they do that, the form's OrderBy property is set, and saved when the form is closed. All you can do to prevent it is clear that property or set it yourself when the form is opened. IMO, this is just about the most anoying "feature" ever invented. I **think** you can avoid the form save by providing a command button that explicitly uses: DoCmd.Close acForm, Me.Name, acSaveNo I usually disable the form's Control and [X] Close buttons on the title bar, but unless the main menu is customized, I don't go so far as to disable its Close menu item. -- Marsh MVP [MS Access] |
#6
|
|||
|
|||
Set Order by
Thank you
That was what I was looking for "Jim Allensworth" wrote in message ... On Sun, 11 Jul 2004 21:21:40 -0400, "Berny" wrote: Can anyone tell me how to set the order by of a form when it opens? I created a form with an order by; users change it and the form keeps the new order which causes problems when the form is opened the next time in the wrong order. Assuming that your order is set in the Record Source, then just set the OrderBy to an empty string. (By default Access keeps the last order set) Private Sub Form_Open(Cancel As Integer) Me.OrderBy = "" End Sub If you want to set an order on open. Private Sub Form_Open(Cancel As Integer) Me.OrderBy = "SomeField" Me.OrderByOn = True End Sub - Jim |
#7
|
|||
|
|||
Set Order by
Thanks, Marsh.
acSaveNo is what I have used in the "Close" button. My users never complained of this problem even those some of them use "Sort". Will have to do some more test on this. -- Cheers Van T. Dinh MVP (Access) "Marshall Barton" wrote in message ... IMO, this is just about the most anoying "feature" ever invented. I **think** you can avoid the form save by providing a command button that explicitly uses: DoCmd.Close acForm, Me.Name, acSaveNo I usually disable the form's Control and [X] Close buttons on the title bar, but unless the main menu is customized, I don't go so far as to disable its Close menu item. -- Marsh MVP [MS Access] |
#8
|
|||
|
|||
Set Order by
Van T. Dinh wrote:
Thanks, Marsh. acSaveNo is what I have used in the "Close" button. My users never complained of this problem even those some of them use "Sort". Will have to do some more test on this. Van, Please let us know what your test's do or don't tell you. I have been very curious about this issue ever since I had a client that had their app made unusable because Access somehow or other managed to save a filter/orderby that was illegal (preventing the form from opening). Makes me wish that MS had never invented this "feature". I also have a nagging suspicion that Access isn't really saving the entire form when it saves the Filter and OrderBy properties, because the bloat issue might be pretty severe. -- Marsh MVP [MS Access] |
#9
|
|||
|
|||
Set Order by
"Marshall Barton" wrote in message
Van, Please let us know what your test's do or don't tell you. I have been very curious about this issue ever since I had a client that had their app made unusable because Access somehow or other managed to save a filter/orderby that was illegal (preventing the form from opening). I had that happen because the client clicked the Save toolbar button, thinking to save the record she'd been editing, after my code had opened the form in Data Entry mode. She phoned me up to say "all my records have disappeared!" My fault for giving her full menus. -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Wrong sort order of report's details section | dsjohn_242 | Setting Up & Running Reports | 6 | July 12th, 2004 10:21 PM |
Inhereting the sort order | Dan St.John | Setting Up & Running Reports | 1 | July 9th, 2004 03:30 AM |
2nd ORDER BY in form fields | an | General Discussion | 1 | June 25th, 2004 12:23 AM |
Adding auto-numbered field screws up Table order | Carl | Database Design | 5 | May 30th, 2004 03:25 AM |
X Axis Sort Order | Jason | Charts and Charting | 2 | October 9th, 2003 04:12 PM |