Subject Re: lookupsql and Combobox ; where is the missing link :: Solution ::
From Mervyn Bick <invalid@invalid.invalid>
Date Sun, 31 May 2020 13:14:24 +0200
Newsgroups dbase.getting-started

On 31/05/2020 12:04, Dirk wrote:

> Mervyn,
>  ¬†thanks for pointing me on the distinct of the countries..
>  ¬† why you don't write a book as Sql and dBase :)

It's never going to happen.  You'd never believe it judging from some of
the long replies I post but I hate writing.  I occasionally get the urge
to create an add-on for the tutorial dealing with the techniques needed
for working with SQl servers.  If I sit and think about it for long
enough the urge goes away. :-)

> your remark on combobox , in my programm i use an array to fill up the
> combobox.

If it works, it's not wrong. :-)  On the other hand, you already have a
query open to give you the country names.  Why not simply use the field
directly from the rowset as the combobox's dataSource?  Once the
combobox's dataSource has been populated the combobox doesn't reference
the query again so you can use the query to get the landcode value which
you need for your filter.  Limiting the contents of the rowset to only
those countries reflected in STAMMDAT2 helps to speed up finding the
landcode for a given country.

If you use an array you will need to rebuild it when you add a record to
STAMMDAT2 from a new country before you can assign the new array to the
combobox's datasource proprety.  By using the field directly you need
one line of code to requery() before you reassign the field to the
combobox's dataSource property.


> thanks again for your attention
> Dirk