Disable Sorting on a Continuous Form

I have a main Form, with a Subform on it. The subform shows Transactions, which are calculated to acheive a running balance. If a user right clicks, and sorts this form, the calculations are not correct.

How can I disallow sorting on this form? I do want to sort data on the main form, just not on the subform.

From what I see, a user can click a record on the subform, and use the toolbar at the top of the screen to sort, or a user can right click a field and sort ascending/descending.

I need to disable both methods for the continuous subform.

Thanks! - AB
Who is Participating?
Your users also have 2 options for sorting at the top of the screen.  One one the Form View toolbar and another in Records -> Sort  in Access's built-in menubar.

You can suppress these toolbars so that the user can only sort through the right-click menu on the main form.  
- Tools -> Customize ... Uncheck the Form View toolbar  

'This will suppress the built-in menubar
- Tools -> Customize -> New  (Call the new toolbar mnuBlank)
- Click the properties button, and select Menu Bar for the type.  
- In your main form and subform's properties, select mnuBlank  for the Menu Bar property (under the  "Otter" tab).

You can disable the right click menus for your application altogether:

CurrendDB.Properties("AllowShortcutMenus") = False

This is a startup option, and will take effect the nextt time the DB is opened.

You can also set up a dummy right-click menu for that specific form and then disable the dummy menu.  That would only affect the forms you associate the right click menu with:

Tools -> Customize -> New Menu  (give  it a name)
Click the properties button, and select "pop up"
Close out of the customize window.
In your form's Short Cut Menu property, select the name of your new short cut menu.
To disable it through VBA:

CommandBars("ShortCutMenuName").Enabled = False
abinbostonAuthor Commented:
To disable it through VBA:

CommandBars("ShortCutMenuName").Enabled = False

Thanks - sounds like that will work... where do I disable it?
when opening the form, or on click? or whenloading a main menu? or??

Thanks - Anthony
Hi Anthony,

If you have workgroup security, you could disable it in a command button which is visible only to certain users...

However, rereading your post... If you don't have the need for a custom sort menu like that, rather than creating a custom shortcut menu just disable the built-in one for your subform through the properties sheet:

Under the "Other" tab, set "Shortcut Menu" to No.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.