Solved

Enabling Sorting on one column of a subform

Posted on 2014-09-23
5
299 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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