Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set updatable combobox?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00622821
Message ID:
00622843
Views:
25
This message has been marked as a message which has helped to the initial question of the thread.
Hi Inge,

You need to select both the descr and code into the combo and bind the combo to the code column.

Change you rowsource to:
rowsource=SELECT descr, code FROM jobs
Set the combos
.boundColumn = 2
.columnWidths = "-1,0" && I think the -1 works here to use the default column width.

Now the user will see "descr" in the combo and when they pick something the 2nd column "code" will be stored in the controlSource.

Also, have a look at file#9596 in the dl area. It's a class by Mark McCasland that shows how to use an array instead of SQL in the rowsource, plus shows how to handle a bunch of other combo issues (like handling a code that doesn't exist in the jobs table). Pretty darn slick.

>I have a combobox setup with:
>rowsourcetype=SQL
>rowsource=SELECT descr FROM jobs
>(the combobox is populated with available JOBS.descr)
>
>JOBS is a look-up table with 2 fields: descr & code.
>I have another table called myTable, with a field called myTable.JobCode.
>(JOBS is a lookup table for myTable.jobcode).
>
>How do I set up the controlsource property (& any other properties) so that the combobox shows/displays corresponding JOBS.descr (instead of myTable.jobCode) when the form is showing a record from myTable?
>
>When user selects another JOBS.descr from the combobox, I'd like JOBS.code to be written to myTable.Jobcode.
>
>How do I set up the controlsource / boundcolumn / .... ???
>THANKS ALL!
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Previous
Reply
Map
View

Click here to load this message in the networking platform