>I have a combobox class which uses an array ROWSOURCE. The way my code currently works, the array is populated via a SQL SELECT statement. If no records are retrieved by the SQL, the array has 1 row, with all elements being .F. Conceptually, this is a zero-row array, and therefore a zero-option combobox.
>
>Is there any way to make the combobox NOT drop down in this situation? I tried putting the following code in the DROPDOWN() event:
IF VARTYPE(MyArray[1]) = "F"
> NODEFAULT
>ENDIF
but to no avail.
One suggestion here - the type will be 'L' not 'F' (the variable type is a Logical).
The obvious solution is to not use an array at all - if you used a cursor rather than an array, you'd end up with a cursor with a RECCOUNT() of 0; you avoid all the headaches associated with an array, including the scoping issues, the limit on the number of elements, etc.) And the data type and value widths will always be a consistent value, unlike the array.
>
>If I can't suppress the drop down, I can instead populate that one row with dummy values -- but then I have to make all of my code handle the possibility that the user has selected the "dummy" row.
>
>Am I missing the obvious solution here?