Subject Re: SYNTAX ERROR
From Bruce Beacham <bbeacham@no_plm_lowman.co.uk>
Date Tue, 18 Jul 2017 23:17:59 +0100
Newsgroups dbase.getting-started

On 17/07/2017 07:44, Mustansir Ghor wrote:
> In the below function following statement in the do case statement that gives error "
> form.labrsn.visible=true" as Data type mismatch expecting an object.
>
> function GRID1_onSelChange()
>          with (form.labres1.rowset.fields["item"].lookupRowset)
>                   do case
>                  case fields["slimit"].value="N"
>                    form.labrsn.visible=true
>                    form.labrsn.setfocus()

> Any leads what is the error

I think you'll find that within a WITH...ENDWITH block of a query (an
independent object in a way that, say, a text control is not) the scope
of variables changes, and form. is not known.

Save and run this code and note how far the code gets:


Bruce Beacham

********************************
d = new database("dbasesamples")
f = new form()
f.tx = new text(f)
f.q = new query(f)
f.q.sql = [select * from :dbasesamples:fish]
f.q.active = true
with (f.tx)
    form.classID = 3
    ? "Done text control"
endwith

with (f.q.rowset.fields["name"])
     form.classID = 3
     ? "Done field"
endwith

return

********************************