Solved

Enabling Sorting on one column of a subform

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

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 48

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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