>>>Hi,
>>>
>>>I have a listbox, populated with an array: Thisform.aNames
>>>The list is restricted to the first 10 elements only so NumberOfElements is set 10
>>>The array is constructed in myForm with aNames[10,2]
>>>
>>>and populated with a select:
Select naw.fullname, naw.ID from NAW where substring(fullname,1) = ? m.lcLetter into array aNames[10.2]
>>>this works fine, however, when there is not enough data to populate 10 fields the remaing are shown in the listbox as .F., how should I change to avoid this, prefer to show [ ] (nothing)
>>
>>Honestly I don't understand how that really works in the first place. I just tested thinking I might be wrong but that kind of syntax is giving me error ("SQL: Statement is invalid"). You can't really specify the array size, can you?
>>Whatever the initial size of an array is, after the select statement it would be [selected rows count, columns count].
>>
>>
>>Local array laCheck1[300,100], laCheck2[1]
>>Select * from (_samples+'data\customer') into array laCheck1
>>Select * from (_samples+'data\customer') into array laCheck2
>>
>>? Alen(laCheck1,1), Alen(laCheck1,2)
>>? Alen(laCheck2,1), Alen(laCheck2,2)
>>
>>
>>The only exception to this is when select doesn't return any rows. Then the array's original size and values are preserved.
>
>Correct, that is my case.
>When one is working with the application for the first time, there are yet no records in the tables and this will result in 10 rows with .F. which I do not like.
>So I will now parse through the array and replace all the .f. values with '' easy enough
>
>Thanks for your solution,
>
>Regards,
>Koen
Then you could simply set your array to be "" initially:
aNames = ''
Elements then would all be '' instead of .F.
However, I would repeat, SQL rowsource is the better alternative.
PS: With SQL rowsource your ID would be an INT if that is an INT, not text that you need to make unnecessary conversions.