Disable Sorting on a Continuous Form

Posted on 2006-05-11
Last Modified: 2008-02-26
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
Question by:abinboston
    LVL 61

    Expert Comment


    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.

    LVL 61

    Expert Comment

    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

    Author Comment

    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
    LVL 61

    Expert Comment

    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.
    LVL 61

    Accepted Solution

    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).

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now