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

Combo Box Question 1

Status
Not open for further replies.

wbwillson

Technical User
Oct 7, 2002
52
GB
I have a problem with a combo box. My Combo box looks up its values from a separate table called "contacts". When the user selects a name it appears on the form but in the actual table it has a value like 1, 2, 3 etc..

How can I get the combo box to put the actual text from the combo box list into the field in my table?

Bill
 
Bill - you DON'T want to.

The whole point about RELATIONAL databases is that you store the reference to the record in the Contacts table rather than the contents of the record in the Contacts table.

Your combo box is doing exactly what it should.


If you then want to display the data from the Contacts table on a Form or Report you can do that by :-
( for 'Form' below read 'Form or Report' )


Have a control on the form bound to the field containing the contact reference ( ContactRef )
Make this control hidden ( .Visible = No )

Then have a text box control with a ControlSource of:-
=DLookUp("NameField","Contacts","ContactId = ContactRef")


As DLookups take ( relativly ) quite a long time, if you need more than one DLookup from any given table on a form then you should use a Recordset inside the form's On_Current event ( On_Format in a Report ) and set the text box contents from the returned values.




'ope-that-'elps.



G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.

Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need! :-D

 
Thanks, Thats exactly what I needed to know! I was trying to get the info to show on a report. Thanks again!

Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top