Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error: 1881 when setting the controlsource in a combobox
Message
From
07/04/2000 04:26:52
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
07/04/2000 03:56:53
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00356369
Message ID:
00356699
Views:
11
>>>I have a strange problem with the combobox and the controlsource property. Becouse of a select-sql command that has to include THISFORM I have to set the rowsource from init event. The code in the init event looks like this:
>>>
>>>THIS.ROWSOURCE = "SELECT ALLTRIM(efternamn) +', '+ ALLTRIM(fornamn), person.idnr " + ;
>>> "FROM mds!person, mds!foretag, mds!connect INTO CURSOR tKlientPerson " + ;
>>> "WHERE foretag.idnr = THISFORM.oForetag.GetIdnr() AND foretag.idnr = connect.idnr_1 " + ;
>>> "AND connect.idnr_2 = person.idnr ORDER BY 1"
>>>
>>>THIS.REQUERY()
>>>THIS.CONTROLSOURCE = 'THISFORM.oKlient.df_person' && ERROR
>>>DODEFAULT()
>>>
>>>When I do THIS.CONTROLSOURCE = ... I get the following error:
>>>1881 - Error with cboPerson - Value : Data type mismatch.
>>>
>>>Why? The control shows the right information so there is nothing wrong with the select-sql command. But I can't set the controlsource without having this problem. How can I solve this?
>>
>>
Mârten,
>>If 'THISFORM.oKlient.df_person' is something initialized to say .f. than this error would occur. For a combobox value could be set to either char or numeric.
>>Cetin
>
>Thanks for solving the problem for me. My object is indeed .F. at this point and moving the setting of the controlsource to the forms init event solved it.
>
>But one more question comes up after solving this one. When dose VFP set the controlsource property? Is it after all init events has been executed?


Good question :) Initialization start with the innermost object and end in form init. But the objects are there. You can reach any object's PEM from any level. That's innermost object could reach properties of form which is not initialized yet. If controlsource was part of property (not set at or after object's init) then innermost object would reach it. If the order of your objects' init were dfperson then listbox I think it should operate w/o an error.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform