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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox Lookup doesn't work.

Status
Not open for further replies.

Thijs

Technical User
Nov 24, 2000
31
NL
Hi all,

I've got the following problem:

I have a form which selects data from table "bewoner". The only problem is that you can only search on bewoner_id. But I also want to be able to search on bewoner_achternaam (=lastname in dutch).

What I did is the following. I made a combobox which selects id + lastname and shows only the lastname. But now I want the value (id) to look up the comparing value in "bewoner".

To be more precise. If I select in de Combobox Kromhout, 001. Then in the other fields (firstname, lastname, city, etc) he has to select the right data.

I hope I made myself clear.

Thanks in advance,

Thijs Kromhout
The Netherlands.
 
Thijs,

The trick with combo box look-ups is to get the bound column correct (which column of the table is the lookup based on) and then reference (using the textbox 'Control Source' property) the remainder by the Column#:

cboID is the bound column

txtLastName Control Source property will read:
=cboID.Column (1)

One quirk of Access is that it really likes the bound column to be the first column (Column (0)). It is really hit-and-miss to get one to work with bound column# >0.

Hope that helps.
Cj
 
Thanks for your advice.
But I made a stupid error :-(

I simply needed to type the following:

Me.soe_nummer.Value = Me.Combo30.Value

And the combo selects id+lastname...

Thanks againt though.

Grtz,

Thijs Kromhout
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top