Solved

Enabling Sorting on one column of a subform

Posted on 2014-09-23
5
291 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
ID: 40341033
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
ID: 40341224
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
ID: 40341238
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
ID: 40341269
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
ID: 40341789
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

920 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

15 Experts available now in Live!

Get 1:1 Help Now