Lookups with related tables

SueB77

New member
Local time
Today, 17:31
Joined
Jan 24, 2012
Messages
7
I have created a form and am trying to insert a lookup field. I can actually get it to pull the correct information from another table. However, the lookup displays first and last name (two separate fields) for my choices. I choose the one I want and it only inserts the first name into the form. Can I get it to insert both names?
 
Yes you can Sue

First create a query that concatenates the first and last names into a field.

Then in the table into which you put the information have a number field which you will be storing the results from any selected combo box.

Then create a combo field on the form and reference the combo field to the query that has the concatenated field but store the reference the number. The number will be stored in the table but importantly the combo box will on the fly display the full name of the individual. By manipulating the width of the fields in the combo box it appears as if the name is being stored in the database when in actual fact the number is being stored.

See the example database attached in this post - which shows a number of different ways of implementing combo boxes. Look to example method one and carefully flick between the table field holding the information and the combo box properties to see how width is set to zero.

http://www.access-programmers.co.uk/forums/showpost.php?p=1129787&postcount=29

The alternative is to hold the full text name as a result of the concatenated field but it is not quite so elegant.
 

Users who are viewing this thread

Back
Top Bottom