Solved

Enabling Sorting on one column of a subform

Posted on 2014-09-23
5
314 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 50

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 50

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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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…
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 …

696 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