Prevent sorting of data in a form

D

dhstein

I have a form based on a query. The form is a display for information
purposes only. The order of the data is important, so I want to prevent any
sorting of the records. I restricted edits but I'm not sure how to restrict
sorting. Possibly this should be a report - but I like the continuous
display that the form allow. Can a report display the same way? Thanks for
any help on this.
 
K

KARL DEWEY

The order of the data is important, so I want to prevent any sorting of the
records.
This is contradictory to say not sorting but order is important. If you do
not sort the query it will not be sorted.
You can add a field for special sort of your own like A,D,C,B,E,F,I,H,G, etc.
 
D

dhstein

Thanks for the response Karl. The order is important - which is why the
query produces the information in a very specific order (the query is sorted)
- and the form represents the data in the same order. I want to display it
that way and not allow the user to change the order of the data.
 
K

ken

I think you must be referring to the ability to sort a form by means
of the A-Z or Z-A buttons on the toolbar. These set the form's
OrderBy and OrderByOn properties, which will override the ORDER BY
clause of the underlying query. In fact a query itself can,
surprisingly, have its ORDER BY clause overridden in the same way. If
you put:

Me.OrderByOn = False

in the form's Current event procedure this will go some way to
stopping a user from imposing a sort order on the records as, while
the form will be sorted n the field the user selects to order the
records by, it will revert to the query's sort order once they
navigate to another record, moving the record pointer to the first
record in the query's sort order. This is not a very satisfactory
solution, however, and it would be better to deny users access to this
facility by using a custom menu and toolbar for the form, excluding
the relevant menu items and buttons.

Ken Sheridan
Stafford, England
 
R

Ron2006

The other consideration is that if the application is split as it
ought to be, then IF the user gets a fresh copy of the application
each time then it will also revert to the original design sequence.

Also if you set the order in the on open event of the (sub)form, I
believe that will also reset it every time the form is opened, even if
they do not get a new version each time they execute.
 
Joined
Jan 11, 2011
Messages
6
Reaction score
0
Apparently if you have Access 2007, customizing right click menus (Shortcut Menu) either involves code, or you have to open it in Access 2003 and customize the menu from there. You can then pick the shortcut menu for Current Database or for Form Properties.

In Access 2003, you go to View, Toolbars, then Customize. Select the Toolbars tab, then create a new menu. Click properties, then from the Type dropdown list, pick "Popup". After that, go back to the Toolbars tab, then check "Shortcut Menus" to get the entire list of all menus. Custom menus appear on the very right hand side. You have to drag commands from the predefined trees over to your custom menu's tree.

For more information, see these articles:
http://www.databasejournal.com/feat...ting-Up-Right-Click-Menus-for-Access-2007.htm
http://www.vb123.com/toolshed/05_map/ch07_rightclickmenu.htm
 

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