dbTalk Databases Forums  

Access ADP Form Sort on ComboBox Text

comp.databases.ms-access comp.databases.ms-access


Discuss Access ADP Form Sort on ComboBox Text in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
bo_dong
 
Posts: n/a

Default Access ADP Form Sort on ComboBox Text - 04-19-2011 , 03:07 PM






Here is BenchmarkCategory table. Notice the BenchmarkCategoryName is
not sorted alphabetically when sorted by BenchmarkCategoryID.

BenchmarkCategory
BenchmarkCategoryName BenchmarkCategoryID
US EQUITY 1
INTERNATIONAL EQUITY 2
US FIXED INCOME 3
NON-US FIXED INCOME 4
OTHER 5

Here is another table Benchmark with a BenchmarkCategoryID column. I
built a form on the table and added a ComboBox displaying the
BenchmarkCategoryName. Because users would like to see Names instead
of IDs. The right hand Column is a ComboBox based on
BenchmarkCatgoryID but displaying BenchmarkCategoryName.

Benchmark
BenchmarkCode BenchmarkCategoryID BenchmarkCategoryID
3molib2 5 OTHER
dowwil 5 OTHER
sbwld 4 NON-US FIXED INCOME
sbnonus 4 NON-US FIXED INCOME
ml3to7 3 US FIXED INCOME
sbhiyld 3 US FIXED INCOME
eem 2 INTERNATIONAL EQUITY
msworld 2 INTERNATIONAL EQUITY
nasdaq 1 US EQUITY
djia 1 US EQUITY

My question is how to sort the ComboBox column based on the names, not
on IDs? So it looks like the below picture, not the above picture?

Benchmark
BenchmarkCode BenchmarkCategoryID BenchmarkCategoryID
sbhiyld 3 US FIXED INCOME
ml3to7 3 US FIXED INCOME
djia 1 US EQUITY
nasdaq 1 US EQUITY
dowwil 5 OTHER
3molib2 5 OTHER
sbnonus 4 NON-US FIXED INCOME
sbwld 4 NON-US FIXED INCOME
eem 2 INTERNATIONAL EQUITY
msworld 2 INTERNATIONAL EQUITY


I did the above picture by changing the RecordSource on the Benchmark
table to

select * from Benchmark c order by (select p.BenchmarkCategoryName
from BenchmarkCategory p where p.BenchmarkCategoryID =
c.BenchmarkCategoryID) desc

But this hack doesn't work in SubForms. Using Profiler, I saw ADP
sending broken queries to SQL Server.

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Access ADP Form Sort on ComboBox Text - 04-19-2011 , 03:29 PM






bo_dong wrote:

Quote:
Here is BenchmarkCategory table. Notice the BenchmarkCategoryName is
not sorted alphabetically when sorted by BenchmarkCategoryID.

BenchmarkCategory
BenchmarkCategoryName BenchmarkCategoryID
US EQUITY 1
INTERNATIONAL EQUITY 2
US FIXED INCOME 3
NON-US FIXED INCOME 4
OTHER 5

Here is another table Benchmark with a BenchmarkCategoryID column. I
built a form on the table and added a ComboBox displaying the
BenchmarkCategoryName. Because users would like to see Names instead
of IDs. The right hand Column is a ComboBox based on
BenchmarkCatgoryID but displaying BenchmarkCategoryName.

Benchmark
BenchmarkCode BenchmarkCategoryID BenchmarkCategoryID
3molib2 5 OTHER
dowwil 5 OTHER
sbwld 4 NON-US FIXED INCOME
sbnonus 4 NON-US FIXED INCOME
ml3to7 3 US FIXED INCOME
sbhiyld 3 US FIXED INCOME
eem 2 INTERNATIONAL EQUITY
msworld 2 INTERNATIONAL EQUITY
nasdaq 1 US EQUITY
djia 1 US EQUITY

My question is how to sort the ComboBox column based on the names, not
on IDs? So it looks like the below picture, not the above picture?

Benchmark
BenchmarkCode BenchmarkCategoryID BenchmarkCategoryID
sbhiyld 3 US FIXED INCOME
ml3to7 3 US FIXED INCOME
djia 1 US EQUITY
nasdaq 1 US EQUITY
dowwil 5 OTHER
3molib2 5 OTHER
sbnonus 4 NON-US FIXED INCOME
sbwld 4 NON-US FIXED INCOME
eem 2 INTERNATIONAL EQUITY
msworld 2 INTERNATIONAL EQUITY


I did the above picture by changing the RecordSource on the Benchmark
table to

select * from Benchmark c order by (select p.BenchmarkCategoryName
from BenchmarkCategory p where p.BenchmarkCategoryID =
c.BenchmarkCategoryID) desc

But this hack doesn't work in SubForms. Using Profiler, I saw ADP
sending broken queries to SQL Server.
It is difficult to understand your issue. A Form has a recordsource
that is used to present the form records in the order you like.

A Combobox has a rowsource that you use to present the data in the list
in the order you like. Ex:
Select CustID, CustomerName From Customers Order By CustomerName
There's 2 columns and I sorted the combo list by the customer name field.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.