Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use combo for fields of a record?
Message
From
03/01/2006 14:16:24
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01082503
Message ID:
01082766
Views:
12
>>>I tried this but it shows entries in these fields for all records in the table. And I want to have the combo show only entries in ONE (currently selected) record.
>>
>>
* combo.init
>>this.addproperty("aFld[1]")
>>this.requery()
>>
>>* combo.requery
>>n=afield(a,"yourtablealias")
>>dimension this.afld[n]
>>for i=1 to n
>>  this.aFld[i]=eval(forceext("yourtablealias", a[i])
>>endfor
>>
>>
>>However, if you have such a table where the entities of the same type are spread across the fields, I'd rather recommend you have a good look at your database design and think it over. There's a good reason why it's so easy to fill a combo with columns from a table, and why you have to do the above kludge to fill it with fields.
>>
>>If these data are coming from an outside source, my sympathies for your trouble.
>
>Thank you very much for the suggestion and sample code. What I decided to do (have not tested yet) is to set the combo RowSourceType to 1 - Value and then set the RowSource to the values in the table fields. And I will do it in the GotFocus method of the combo, since I need to dynamically change the combo RowSource based on the currently selected record.
>
>I know what you are saying about "wrong" database design. It is true, you are right, but for the reasons that are too long to go into right now, I am sticking with the "wrong" design because it is the "right" approach from the business stand point. I know it is confusing though <g>.
>
>Again, thank you for your help.

Um, now I see I forgot that I didn't put the code to set rowsourcetype property to array, and rowsource to "this.aFld", but I figure you saw that.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform