Subject Re: AutoFill_entryfield error
From Tom <IHaveNoEmail@ddress>
Date Sun, 17 May 2020 15:22:46 -0400
Newsgroups dbase.getting-started
Attachment(s) Parallels Picture.png

On 5/17/20 2:55 PM, Ken Mayer wrote:
> On 5/17/2020 11:28 AM, Tom wrote:
>> Using the following code:
>> *
>> ** END HEADER -- do not remove this line
>> //
>> // Generated on 05/17/2020
>> //
>> parameter bModal
>> local f
>> f = new Autofill_EntryfieldForm()
>> if (bModal)
>>     f.mdi = false // ensure not MDI
>>     f.readModal()
>> else
>>     f.open()
>> endif
>>
>> class Autofill_EntryfieldForm of FORM
>>     set procedure to :dUFLP:autofill_entryfield.cc additive
>>     with (this)
>>        metric = 6    // Pixels
>>        colorNormal = "LightGrey"
>>        height = 352.0
>>        left = 850.0
>>        top = 0.0
>>        width = 280.0
>>        text = ""
>>     endwith
>>
>>     this.DATABASE1 = new DATABASE(this)
>>     with (this.DATABASE1)
>>        left = 18.0
>>        top = 16.0
>>        width = 53.0
>>        height = 37.0
>>        databaseName = "JEREMIAHDATA"
>>        active = true
>>     endwith
>>
>>     this.QUERY1 = new QUERY(this)
>>     with (this.QUERY1)
>>        left = 111.0
>>        top = 16.0
>>        width = 39.0
>>        height = 37.0
>>        database = form.database1
>>        sql = "Select * from Demodata"
>>        requestLive = false
>>        active = true
>>     endwith
>>
>>     with (this.QUERY1.rowset)
>>        autoEdit = false
>>     endwith
>> /*
>>     this.AUTOFILL_ENTRYFIELD1 = new AUTOFILL_ENTRYFIELD(this)
>>     with (this.AUTOFILL_ENTRYFIELD1)
>>        onOpen = class::AUTOFILLENTRYFIELD1_ONOPEN
>>        dataLink = form.query1.rowset.fields["provider"]
>>        height = 22.0
>>        left = 41.0
>>        top = 46.0
>>        width = 196.0
>>     endwith
>> */
>>
>>     this.AUTOFILL_ENTRYFIELD21 = new AUTOFILL_ENTRYFIELD2(this)
>>     with (this.AUTOFILL_ENTRYFIELD21)
>>        onOpen = class::AUTOFILLENTRYFIELD21_ONOPEN
>>        dataLink = form.query1.rowset.fields["provider"]
>>        height = 22.0
>>        left = 41.0
>>        top = 190.0
>>        width = 196.0
>>     endwith
>>
>>
>> /////////////////////////////////////////////////////////////////////////////////////////////////
>>
>> /*
>>     Function AUTOFILLENTRYFIELD1_ONOPEN
>>        // values provided from the same table field specified ???
>>        this.dataBase := "JEREMIAHDATA"
>>        this.tableName := "DemoData"
>>        this.fieldName := "Provider"
>>     return
>>        *
>> */
>>
>>    Function AUTOFILLENTRYFIELD21_ONOPEN
>>        // values provided from a separate table list ???
>>        this.dataBaseName := "CONTACTSDATA"
>>        this.tableName := "zContact"
>>        this.fieldName := "FullName"
>>        *
>>     return
>>     *
>>
>> endclass
>>
>> I cannot get the form to run. See attached error message.
>>
>> I understand you cannot run the code since you do not have the same
>> tables but, by inspection, do you see what is causing the error?
>
> The code should not be for the autofill_entryfield's onOpen event
> handler, but the *FORM*'s onOpen event handler. Check the instructions
> for the control carefully ...
>
> The object references are not going to make sense if done the way you
> did it.
>
> Ken
>
Revised code:
*
** END HEADER -- do not remove this line
//
// Generated on 05/17/2020
//
parameter bModal
local f
f = new Autofill_EntryfieldForm()
if (bModal)
    f.mdi = false // ensure not MDI
    f.readModal()
else
    f.open()
endif

class Autofill_EntryfieldForm of FORM
    set procedure to :dUFLP:autofill_entryfield.cc additive
    with (this)
       onOpen = class::Form_onOpen
       metric = 6        // Pixels
       colorNormal = "LightGrey"
       height = 352.0
       left = 850.0
       top = 0.0
       width = 280.0
       text = ""
    endwith

    this.DATABASE1 = new DATABASE(this)
    with (this.DATABASE1)
       left = 18.0
       top = 16.0
       width = 53.0
       height = 37.0
       databaseName = "JEREMIAHDATA"
       active = true
    endwith

    this.QUERY1 = new QUERY(this)
    with (this.QUERY1)
       left = 111.0
       top = 16.0
       width = 39.0
       height = 37.0
       database = form.database1
       sql = "Select * from Demodata"
       requestLive = false
       active = true
    endwith

    with (this.QUERY1.rowset)
       autoEdit = false
    endwith
/*
    this.AUTOFILL_ENTRYFIELD1 = new AUTOFILL_ENTRYFIELD(this)
    with (this.AUTOFILL_ENTRYFIELD1)
       onOpen = class::AUTOFILLENTRYFIELD1_ONOPEN
       dataLink = form.query1.rowset.fields["provider"]
       height = 22.0
       left = 41.0
       top = 46.0
       width = 196.0
    endwith
*/

    this.AUTOFILL_ENTRYFIELD21 = new AUTOFILL_ENTRYFIELD2(this)
    with (this.AUTOFILL_ENTRYFIELD21)
***      onOpen = class::AUTOFILLENTRYFIELD21_ONOPEN
       dataLink = form.query1.rowset.fields["provider"]
       height = 22.0
       left = 41.0
       top = 190.0
       width = 196.0
    endwith
*/

/////////////////////////////////////////////////////////////////////////////////////////////////

    Function Form_onOpen
    * ----------------------------- *
       form.AUTOFILL_ENTRYFIELD21.databaseName := "CONTACTSDATA"
//"MyApp_Data"
       form.AUTOFILL_ENTRYFIELD21.tableName    := "zContact"
//"Autofill_Cities"
       form.AUTOFILL_ENTRYFIELD21.fieldName    := "FullName" //"CityNames"
//      this.dataBaseName := "CONTACTSDATA"
//      this.tableName := "zContact"
//      this.fieldName := "FullName"
    return
    *
/*
    Function AUTOFILLENTRYFIELD1_ONOPEN
       // values provided from the same table field specified ???
       this.dataBase := "JEREMIAHDATA"
       this.tableName := "DemoData"
       this.fieldName := "Provider"
    return
       *
*/
/*
   Function AUTOFILLENTRYFIELD21_ONOPEN
       // values provided from a separate table list ???
       this.dataBaseName := "CONTACTSDATA"
       this.tableName := "zContact"
       this.fieldName := "FullName"
       *
    return
    *
*/
endclass

Produces the attached ...


Tom