Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Numeric key, combo, vfp3
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00056045
Message ID:
00056215
Views:
27
>>The goal is to select items in table3 to associate with the current record in table1, and put a new record in table2 with the parentkeys for each. My first attempt to convert the keys to character in the SQL was to cheat: SELECT field1, field2, ALLTRIM(STR(keyfield)) AS keyfieldstr FROM table3 ... which the manual hints is not acceptable, since STR and ALLTRIM are not among the accepted functions, like COUNT() or whatever. Is such a statement acceptable to the RDBMS police? If I use this SQL to make a cursor and BROWSE, it seems to work. Mycursor.Keyfieldstr has type C and correct values, and no error messages. But when I put this statement in the combo.Rowsource, I still get a numeric combo.value. Should I leave the combo.Rowsource blank and make the cursor in the combo.Init? In the combo.Init, I could say
>>
>>SELECT field1, field2, keyfield,"" AS keyfieldstr;
>> INTO CURSOR mycursor ORDER BY keyfield
>>REPLACE ALL keyfieldstr WITH ALLTRIM(STR(keyfield)) IN mycursor
>>* a bunch of code to make mycursor read-write
>>SELECT 0
>>lnSelArea=SELECT()
>>USE DBF("mycursor") in (lnSelArea) AGAIN ALIAS NewAlias
>>SELECT mycursor
>>USE
>>SELECT 0
>>lnSelArea=SELECT()
>>USE DBF("NewAlias") IN (lnSelArea) AGAIN ALIAS mycursor
>>SELECT NewAlias
>>USE
>>SELECT mycursor
>>*(whew)
>>THIS.RowSourceType = 3
>>THIS.RowSource = mycursor
>>
>>I guess I should USE IN mycursor in the combo.Destroy.
>>
>>Or is there a better way?
>
>A few corrections. The REPLACE ALL command should go after the *(whew), and THIS.RowSourceType = 2, not 3. But I am still getting a numeric combo.Value. Why?


Bret

1. Have you checked to be sure that your BoundColumn property is set to the correct field?

2. Personally, I have had no trouble using STR() in Selects. Alltrim is another matter entirely. That's a no-no. Perhaps something as simple as

SELECT str(keyfield,5), field1, field2 from ..... into MyCursor

Then set the combo RowSource to Mycursor, requery and go. I have a VFP3 system with a numeric ID (blame the client, _I_ couldn't have done it) running with this code. Don't use AllTrim, as it affects the field length in the cursor.

HTH
Barbara
Barbara Paltiel, Paltiel Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform