There are some additional issues that you need to be aware of. They may have been addressed in other replies...I didn't read them all.
1. Don't ever create a variable length key. VFP works on fixed length fields and keys and variable length keys can actually be slower.
2. Don't every do an ALLTRIM() in a SELECT as you may not get all the data. PAD the field. For example, assume a C(20) field. If the first returnd is "SMITH", than all subsequent lastnames will get truncated to the length of the first. "JOHNSON" will end up as "JOHNS"
>hi everyone:
>
>quick question here - i'm using the cursor result of a query as the rowsource for a combobox. when is do:
>
>select lname, fname from table into cursor cursor1
>
>it is 10x (0.4 seconds vs 4 seconds) faster than:
>
>select alltrim(lname) + " " + alltrim(fname) from table into cursor cursor1
>or even:
>select alltrim(lname) from table into cursor cursor1
>
>the rowsource for the combobox is cursor1
>
>i thought it had to do with optimization but there is no "where" clause in the select statement so rushmore shouldn't enter into it. even so, i indexed the table on "alltrim(lname)" and there was no change.
>
>if i'm concatenating (ie lname + fname), i need to do alltrim or the item will not fit in the combobox.
>
>am i doing anything wrong here? would it be better to select lname, fname into the cursor and then somehow take away the spaces when the cursor is made the rowsource? if so, how would i do that?
>
>thanks!
>
>paul
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer