Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alphabetical listings in combo boxes

Status
Not open for further replies.

FireViking

Programmer
Jun 29, 2001
64
AU
Hi all,
I have a combo box that finds and opens the record withiin a table. The feilds contain a numeric ID a company name and a trading name. when the combo is opened the numericID is in order but i want the company name to be in alphabetical order. I have problems trying to use text as a field to search a table.

Can someone help with this simple problem to help a simple guy.
cheers
 
F,

In form design view, select the combo box. If the "Properties" window is not visble, select it from the VIEW menu.

On the Properties window Data tab, select the RowSource property. Click the 'build' button (...) at the end of the line to open the query for the combo box.

Click on the "Sort" line in the Company Name field and select 'Ascending'.

That should do it.


HTH

John

Use what you have,
Learn what you can,
Create what you need.
 
Hi.

Design a query that selects CompanyName, CompanyID, TradingName from your table. Name it qryAlphaCompany. Sort the query on CompanyName. Use the query as the source of your combo box. Or else use an SQL statement that will accomplish the same thing.

In the property sheet of the (unbound) combo box, select Data:
Code:
Row Source Type: Table/Query
Row Source:      qryAlphaCompany
Bound Column:    2
(If CompanyID is your primary key)

In the property sheet select Format:
Code:
Column Count:    3
Column Widths:   1";1";1"
List Width:      3"

Adjust the Column Widths and the List Width to your liking. If you want to display only the company name in the combo box, hide the other two columns by entering:
Code:
Column Widths:   1";0";0"
List Width:      1"

This will hide the 2nd and 3rd columsn


Good luck.

Gus Brunston :cool: An old PICKer, using Access2000
padregus@attbi.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top