Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 15th, 2004, 07:58 PM
Authorized User
 
Join Date: Nov 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to bjackman Send a message via MSN to bjackman
Default Order by on a subform

Hello folks,

I have a subform with a control on it that is a combo box, the query that runs it has thre columns in it but you can only see the one as i have the column widths set to 0, the columns are EMPID, EMPLOYEENAME, EMPLOYEESTATUS. it is currently sorting the reocrds according to empid, is there anyway to get it to sort by the second column so the names are in alphebetical order. any help on this would be greatly appreciated.

Branden

 
Old January 16th, 2004, 01:22 PM
Registered User
 
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Try something like this SQL:

SELECT TblEmp.EmployeeID, TblEmp.EmployeeName, TblEmp.EmployeeStatus FROM TblEmp ORDER BY TblEmp.EmployeeName WITH OWNERACCESS OPTION;

The important item is:
ORDER BY TblEmp.EmployeeName

Change the table and field names to match those in your DB, and then paste the SQL into your combo's RowSource - replacing the table SQL or query you have there now.

Your combo should now display ordered by employee name, rather than by ID number

If you wanted to sort descending you would substitute:
ORDER BY TblEmp.EmployeeName DESC

Once you have the combo working the way you want, you can save the rowsource as a query.

Charlie





Similar Threads
Thread Thread Starter Forum Replies Last Post
ORDER BY Help U.N.C.L.E. SQL Server 2000 13 September 2nd, 2008 09:07 PM
1. Subform = String, Chronological Date order nbuckwheat Access 2 December 21st, 2005 06:50 PM
Filter Subform B Based on Field in Subform A SerranoG Access VBA 3 June 18th, 2004 12:23 AM
Order By with Union agarwalmk SQL Language 3 February 18th, 2004 11:33 AM
document node order vs sort node order. ladyslipper98201 XSLT 2 June 5th, 2003 11:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.