[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1699
  • Last Modified:

value in combo box vfp

Probably simply answered but here goes:
Two tables; one salesmen, the other cities. A Form accessing the salesman has a drop down combo box accessing the city. So a salesman can be allocated to New York City, for example. However, the field 'city'  in the salesman table is a number, joined to the primary key (also a number) in the city table. The name is a descriptive text field in the city table.
So when a user views the combo field on the salesman form he does not see 'New York City" he sees the number that represents it - 1.  Is it possible in vfp to have the name of the city, drawn from the city table, visible in the combo box, rather than its reference number of 1?
1 Solution
It needs to be initialized to the city's name.

IF SEEK(salesman.city, 'cities', 'id')
    cCity = cities.city
Olaf DoschkeSoftware DeveloperCommented:
The closed combobox always displays column 1, so set the city name as first column and the id as second column:

.rowsourcetype = 6 && fields
.columns = "citeis.city,id"
.columnwidths = "100,0"
.boundcolumn = 2
.controlsource = "salesman.cityid"

Bye, Olaf.
ClaytonGlassAuthor Commented:
Simple when you know how! Thanks to you and Captain Cyril. Have chosen yours for no real reason, but it works. Good enough for me!

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now