Solved

Enabling Sorting on one column of a subform

Posted on 2014-09-23
5
278 Views
Last Modified: 2014-10-16
In Access 2010 if have a subform within a Main Form.  I would like to enable sorting on one of the columns in the subform only.  On the Form Properties I have the Shortcut Menu option set to NO to prevent sorting on all columns.  Is there a way to enable this on just one specific column?
0
Comment
Question by:dsoderstrom
5 Comments
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 125 total points
Comment Utility
Not that I know of. It's all or none.

/gustav
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 125 total points
Comment Utility
You could add a button on the MainForm that would sort your datasheet on that column:

Me.YourSubformCONTROL.Form.OrderBy= "YourColumnName"
Me.YourSubformCONTROL.Form.OrderByOn = True

Or:

Me.YourSubformControl.Form.Recordsource = "SELECT Col1, Col2, Col3 FROM YourTable ORDER BY Col3"
0
 
LVL 49

Expert Comment

by:Gustav Brock
Comment Utility
True, but OrderByOn will enable sorting on all coloumns.

/gustav
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 125 total points
Comment Utility
You might want to take a look at the article I wrote a while back on sorting lists and subforms.

It involves passing a list of fields to a subroutine which populates a table and displays a popup form that lets you select the fields you want to use in the sort, the priority of the field in the sort, and the direction of the sort on each column selected.
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 125 total points
Comment Utility
Enabling Sorting on one column of a subform

This can also get a bit messy depending on what else you need:
Do you need edits while sorting?
Do you need to save the sort?
Do you need the form to be sorted by this field by default?
..etc

Other solutions involve manipulating the Ribbon (and the shortcut menus, as you mentioned) to hide/show the sorting options for certain fields...
...all to messy IMHO

What you could also do is just add sorting buttons above that specific field, (to allow sorting).

Yes, ...users will still be able to sort by the other fields, ...but with that one field being the only field with "Sort" buttons, ...at least that will be a visual cue that this is the only field they "should" be sorting...
;-)

Quick and dirt sample db attached...

JeffCoachman
Database31.mdb
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

743 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

13 Experts available now in Live!

Get 1:1 Help Now