Subject Re: lookupsql and Combobox ; where is the missing link
From Mervyn Bick <invalid@invalid.invalid>
Date Sat, 30 May 2020 11:33:33 +0200
Newsgroups dbase.getting-started

On 30/05/2020 11:03, Mervyn Bick wrote:

> When you append or edit a field which has it's lookupsql property set
> you use the "looked up" value.  In other words you type in Belgium and
> dBASE will do the reverse lookup and save B in the field.
>
> To set the filter you need to use the actual value saved in the table
> i.e B for Belgium.  The combobox shows the "looked up" value so you need
> to use the lookupsqlrowset's applyLocate() method to find the equivalent
> code value in the lookuprowset.  In the attached example I've used lur
> (which in my mind stands for look up rowset :-) )  to make the rest of
> the code in the combobox's onChange event handler less cumbersome.

I've had a quick look at the code you posted in the binaries newsgroup.
I'll dig a bit deeper later if the message I posted earlier doesn't help
you solve the problem yourself but please don't use the combobox's
dataLink property.  Rather use the dataSource property.  In fact,
probably for nine out of ten cases you shouldn't need to use a
combobox's dataLink property.

Apart from removing the danger of corrupting the data, using the
dataSource property gives you the option of saving a blank (or a
message) to the combobox's value property when it opens.  It can confuse
the user if the grid opens with records for all countries but the
combobox shows Belgium.  It also means that if the user wants to show
only records for Belgium he/she has to select another country and then
select Belgium.   With the combobox showing  blank  or perhaps "Select
country" showing records for all countries when the form opens makes
sense.  Alternatively you could, of course, set the filter to Belgium
(or whatever is showing in the combobox) when the form opens as these
are the records the user is most likely to want.

Mervyn.


Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0