Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Database Design / April 2005

Tip: Looking for answers? Try searching our database.

How can I stop items in a combo box automatically sorting into al.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CarolineMerryl - 23 Apr 2005 12:05 GMT
I want to create a combo box with, in order, Detached, Semi-detached,
Bungalow, Flat, Other but the choices KEEP appearing alphabetically.  I would
be delighted to hear from someone who knows how the answer.
tina - 23 Apr 2005 12:58 GMT
assuming the combo box's RowSource is a query or SQL statement, one solution
would be to add a calculated field, using the Switch() function to number
the choices, as

Switch([MyFieldName] = "Detached", 1, [MyFieldName] = "Semi-detached", 2,
[MyFieldName] = "Bungalow", 3, [MyFieldName] = "Flat", 4, [MyFieldName] =
"Other", 5)

replace MyFieldName with the name of the field that holds the values
"Detached", etc. then sort Ascending on the calculated field.

hth

> I want to create a combo box with, in order, Detached, Semi-detached,
> Bungalow, Flat, Other but the choices KEEP appearing alphabetically.  I would
> be delighted to hear from someone who knows how the answer.
CarolineMerryl - 24 Apr 2005 01:21 GMT
Tina,
Many thanks!
Caroline

> assuming the combo box's RowSource is a query or SQL statement, one solution
> would be to add a calculated field, using the Switch() function to number
[quoted text clipped - 13 lines]
> would
> > be delighted to hear from someone who knows how the answer.
Duane Hookom - 23 Apr 2005 16:17 GMT
If you want to see records in a particular order, you have to be able to
create an expression based on field values to sort. I would probably add a
field to your lookup table that identifies the order. If you don't want to
do that, you could create a sorting expression in the row source sql like;
 SortOrder: Instr("DSBFO", Left([YourField],1)

Signature

Duane Hookom
MS Access MVP

>I want to create a combo box with, in order, Detached, Semi-detached,
> Bungalow, Flat, Other but the choices KEEP appearing alphabetically.  I
> would
> be delighted to hear from someone who knows how the answer.
tina - 24 Apr 2005 11:28 GMT
i hoped somebody would post a better solution than that clunky Switch()
function. thanks Duane!  <bows and smiles, accepts 2nd oar gratefully and
finds rowing much easier>

> If you want to see records in a particular order, you have to be able to
> create an expression based on field values to sort. I would probably add a
[quoted text clipped - 6 lines]
> > would
> > be delighted to hear from someone who knows how the answer.
Duane Hookom - 24 Apr 2005 16:50 GMT
I actually would add a field to the table since the order could be
maintained in data rather than an expression.

Thanx,
Duane Hookom
MS Access MVP

>i hoped somebody would post a better solution than that clunky Switch()
> function. thanks Duane!  <bows and smiles, accepts 2nd oar gratefully and
[quoted text clipped - 15 lines]
>> > would
>> > be delighted to hear from someone who knows how the answer.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.