PC Review


Reply
Thread Tools Rate Thread

Combo box that displays field from another table

 
 
=?Utf-8?B?bWljaGlydXJl?=
Guest
Posts: n/a
 
      15th Oct 2006
I have the following 2 tables.
1. Company Table - with fields "CoID" & "CoName"
2. Events Table - with fields "EventName" & "CoID"

I've created a form based on Events Table, and want to add a field that
displays the respective CoName from Company Table.

I've tried to create a combo box based on a query linking CoID from Events
Table & CoName from Company Table. Also, I've used the following code,
wishing to display the correct CoName in combo box in respect to the "CoID"
in the form.

Private Sub Form_Current()
ComboCoName = CoID
End Sub

However, only the CoID is displayed in the combo box instead of the CoName.
Please help. Thanks.



 
Reply With Quote
 
 
 
 
Van T. Dinh
Guest
Posts: n/a
 
      15th Oct 2006
If you use CoID, CoName in that order as the RowSource of your ComboBox then
you need to set the ColumnWidths Property of the ComboBox with the width of
the first Column to zero.

Access ComboBox always so the first visible Column. Hence if you want to
show the second Column value, you must set the width of the first Column to
zero.

Check Access Help on the Column Widths Property.

--
HTH
Van T. Dinh
MVP (Access)



"michirure" <(E-Mail Removed)> wrote in message
news:187264EA-8CFF-4B2F-9C42-(E-Mail Removed)...
>I have the following 2 tables.
> 1. Company Table - with fields "CoID" & "CoName"
> 2. Events Table - with fields "EventName" & "CoID"
>
> I've created a form based on Events Table, and want to add a field that
> displays the respective CoName from Company Table.
>
> I've tried to create a combo box based on a query linking CoID from Events
> Table & CoName from Company Table. Also, I've used the following code,
> wishing to display the correct CoName in combo box in respect to the
> "CoID"
> in the form.
>
> Private Sub Form_Current()
> ComboCoName = CoID
> End Sub
>
> However, only the CoID is displayed in the combo box instead of the
> CoName.
> Please help. Thanks.
>
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: adding one field to table driven combo combo box Jeanette Cunningham Microsoft Access Forms 1 8th Apr 2009 02:27 AM
how do l link a combo box so it displays another field =?Utf-8?B?Q296?= Microsoft Access Forms 1 12th Sep 2006 12:30 PM
Want combo box to display 3 fields from my table but only displays one vanilla_bean_orange via AccessMonster.com Microsoft Access Form Coding 3 16th Jan 2006 10:20 AM
Create Drop Down List that displays only field names from a table JS Microsoft Access 5 25th Jul 2005 12:34 PM
Combo Box displays numbers in table instead of value chosen =?Utf-8?B?c3BhY2Vyb2NrZXQ=?= Microsoft Access Forms 7 5th Nov 2004 02:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:45 PM.