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

What is the best possible way to work with combo boxes on a form? 1

Status
Not open for further replies.

NobleDBell

Programmer
Jul 28, 2003
7
US
Hello,
I know there is an easy way to do this but I am not sure how to go about doing it.

I have a main form and one of the fields is a combo box that pulls data from another table. The table the data is pulled from has an ID field and a NAME field and a PHONE field.

I want to be able to display the name in the combo box when a user selects one rather than the ID. I also need to be able to populate another field on the main form with the phone number from the selected combo box name.

What is an easy way to do this? I am working on a project for a client and I am stumped. Your help is appreciated.
 
Hi,

You can initially display as many fields as you wish that are held in a combo by looking at it's properties.

Best way is to paint another combo and use the wizard to stipulate what you want.

However, the property to look at adjusting is:
Properties->Format->Column Widths (0 hides 'em).

To get a particular combo column value across to a textbox then use this in the combo <on change> event:

mytextbox = mycombo.column(0) (if 1st column in combo)
mytextbox = mycombo.column(1) (if 2nd column in combo) etc

Regards,

Darrylle



&quot;Never argue with an idiot, he'll bring you down to his level - then beat you with experience.&quot; darrylles@totalise.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top