value in combo box vfp

Posted on 2011-10-10
Last Modified: 2012-05-12
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?
Question by:ClaytonGlass
    LVL 27

    Expert Comment

    It needs to be initialized to the city's name.

    IF SEEK(, 'cities', 'id')
        cCity =
    LVL 29

    Accepted Solution

    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 = ",id"
    .columnwidths = "100,0"
    .boundcolumn = 2
    .controlsource = "salesman.cityid"

    Bye, Olaf.

    Author Closing Comment

    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!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: (http://msd…
    PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now