Form

dr223

Registered User.
Local time
Today, 09:17
Joined
Nov 15, 2007
Messages
219
Hi,

I have a table on my db called nationality which is built up of two fields;
1) nation_code 2) nation

On my main form, called stud_details I have a field called cbonation which has a combo box with only the nation displayed not the nation_code.

What I want to do is when I scroll on the combo box and find a nation such as UK , instead of the nation to be populated on the field I want the nation_code to be populated instead.

This code is not working any help please

Private Sub cbonation_AfterUpdate()
cbonation = Me.Nationality.Column(0)
End Sub

Can this be done anyway!!!!


Thanks
 
If I understand your question correctly you want the combo box to display the actual code instead of the actual name. If that's the case then I suggest you have a look at the videos here starting at video number two.

Bear in mind that the table behind the form, the table that the combo box is bound to, should and will always record the reference number to the country, all you are doing is showing the reference number or the country Text. You could show both in your combo box, when it is selected, alternatively you could show one in the combo box and one in a separate text field, you should get what I mean from the videos.
 
Thanks for the forward which I reviewed.

I understand the method there is I will have a combo box, when selected will update another text box/text boxes. Also, have a combo box with both the fields then used to update only one field and populate the rests on the text box. Am familiar with both techniques.

My question is, therefore, you can't have a combo box which shows one field (nation) only. But when selected to populate the same field with another field (nation_code), which is stored within the table.

The others two procedures as shown in your example are understood....

Thanks
 
>>>But when selected to populate the same field with another field (nation_code), which is stored within the table<<<

Well you can link the combo box to any data through its Row source, so I presume you could link it to another field in your table, although I don't believe I've done this.
 

Users who are viewing this thread

Back
Top Bottom