Subject Re: datasource
From Mervyn Bick <invalid@invalid.invald>
Date Tue, 13 Aug 2019 15:25:24 +0200
Newsgroups dbase.getting-started

On 2019-08-13 1:50 PM, Mustansir Ghor wrote:
> Dear All
>
> I have an array datasource of COMBOBOX CBACC whose lostFocus is assign to following function. The form.cbcustomer funtions correctly based on valu of CBACC but when I close the form it hangs.
>
>
>    function CBACC_onLostFocus()
>       if this.value="EXPENSES"
>         form.cbcustomer.datasource=form.qexpenses.rowset.fields["NAME"]
>      endif
>      if this.value="CUSTOMER"
>       form.cbcustomer.datasource=form.qcustomer.rowset.fields["NAME"]
>     endif
>         
>        return
>
> Can anybody enlighten on the reason for the form to hang.
>

I don't know why it happens but the work-around is to null the
form.cbcustomer.datasource property before assigning a new value to the
datasource.

   function CBACC_onLostFocus()
      if this.value="EXPENSES"
         form.cbcustomer.datasource=""
         form.cbcustomer.datasource=form.qexpenses.rowset.fields["NAME"]
      endif
      if this.value="CUSTOMER"
         form.cbcustomer.datasource=
         form.cbcustomer.datasource=form.qcustomer.rowset.fields["NAME"]
      endif
      return

Mervyn.