Subject Re: requery problem
From Mervyn Bick <invalid@invalid.invalid>
Date Wed, 8 Jan 2020 17:03:57 +0200
Newsgroups dbase.getting-started

On 08/01/2020 00:55, charlie wrote:
> OK the requery works well but it make the program unstable.   After the first 1 or 2 times trying to use a push button which deletes items then requeries to change the grid and other entryfields inevitably the program says that it has an execution error or something like that then shuts down.  It is absolutely caused by the requery which I have in ongotfocus.
>

Nine queries on the same table shouldn't be a problem.  There is,
however, one possibility that we need to exclude.

Where the query uses an ORDER BY clause, e.g master7 and master9, dBASE
creates a _qsqlnnn.dbf file.  These files are normally deleted when the
program closes but occasionally one gets left behind.   If it ever gets
to the stage where 1000 are left lying around dBASE gets unhappy but
it's a different error message.  It's a good idea to occasionally do
some housekeeping and delete any left overs.

dBASE may be having trouble dealing with a requery that involves a
_qsqlnnn.dbf file.

I suggest commenting out the requery() commands for master7 and master9.
  Make some changes and save and requery() and then change the values
back.  Do this several times and see if dBASE stands up to this.

Mervyn.










> Here is the original querys and the requeries.  Anyone have any idea how to fix this?
>
>    this.MASTER2 = new QUERY(this)
>     with (this.MASTER2)
>        left = -58.0
>        top = 13.0
>        database = form.database1
>        sql = 'select * from "master" where sauc = "T"'
>        active = true
>     endwith
>
>     this.MASTER5 = new QUERY(this)
>     with (this.MASTER5)
>        left = -58.0
>        top = 13.0
>        database = form.database1
>        sql = 'select * from "master" where sauc = "Y"'
>        active = true
>     endwith
>
>     this.MASTER4 = new QUERY(this)
>     with (this.MASTER4)
>        left = -58.0
>        top = 13.0
>        database = form.database1
>        sql = 'select * from "master" where sauc = "X"'
>        active = true
>     endwith
>
>     this.MASTER1 = new QUERY(this)
>     with (this.MASTER1)
>        left = -58.0
>        top = 13.0
>        database = form.database1
>        sql = 'select * from "master" where (bdate = :ddate) and (qty-hold>0) and (auct = 0)'
>        params["ddate"] = {01/07/2020}
>        active = true
>     endwith
>
>     this.MASTER8 = new QUERY(this)
>     with (this.MASTER8)
>        left = -58.0
>        top = 13.0
>        database = form.database1
>        sql = 'select * from "MASTER.DBF"'
>        active = true
>     endwith
>
>     this.MASTER6 = new QUERY(this)
>     with (this.MASTER6)
>        left = -58.0
>        top = 13.0
>        database = form.database1
>        sql = 'select * from "master" where sauc = "Z"'
>        active = true
>     endwith
>
>     this.MASTER7 = new QUERY(this)
>     with (this.MASTER7)
>        left = -58.0
>        top = 13.0
>        database = form.database1
>        sql = 'select * from "master" order by part_no'
>        active = true
>     endwith
>
>     this.MASTER3 = new QUERY(this)
>     with (this.MASTER3)
>        left = -58.0
>        top = 13.0
>        database = form.database1
>        sql = 'select * from "master" where sauc = "E"'
>        active = true
>     endwith
>
>     this.MASTER9 = new QUERY(this)
>     with (this.MASTER9)
>        left = -58.0
>        top = 13.0
>        database = form.database1
>        sql = 'select * from "MASTER.DBF" where sauc != "" order by sauc asc ,part_no asc'
>        active = true
>     endwith
>
>
>    function form_onGotFocus()
>         
>         //form.master1.requery()
>                 //form.master2.requery()
>                 //form.master3.requery()
>                 //form.master4.requery()
>                 //form.master5.requery()
>                 //form.master6.requery()
>                 //form.master7.requery()
>                 //form.master8.requery()
>                 form.master9.requery()
>                 form.rowset.first()
>
> Don't worry about the comments.  I have trued many variations....
>
> Thanks!!
>