Subject Re: requery problem (semi reason)
From charlie <tm@tc.com>
Date Wed, 08 Jan 2020 20:36:52 -0500
Newsgroups dbase.getting-started

OK I have a theory on what is happening but not sure why.

If I put code that populates the entryfields with data and the requery in the same function such as form ongot focus, the problem persists with the form freezing and closing with the windows error.

But if I put the code in the onopen function of the form and leave the requery in the ongotfocus for the form I have no problem.  (Other than the entry fields don't get updated correctly.

So here are the queries and the code below.  Can anyone give a reason that this is happening so I can fix it?  Thanks much for putting up with this.

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.master9.rowset.first()
                   return

   function form_onOpen()
          set procedure to test.pop additive
          form.popupMenu := new testpopup(form,"testPOPUP")
                            cnt = 0
          sel = 0.00
          cnt = form.master2.rowset.count()
          form.entryfield3.value = cnt
          if cnt # 0
             do while not form.master2.rowset.endofset
                     sel = form.master2.rowset.fields["sell"].value +sel
                          form.master2.rowset.next()
                        enddo  
                        form.entryfield4.value = sel
          else
             form.entryfield4.value = 0.00
          endif
          
          cnt = 0
          sel = 0.00
          cnt = form.master3.rowset.count()
          form.entryfield9.value = cnt
          if cnt # 0
             do while not form.master3.rowset.endofset
                     sel = form.master3.rowset.fields["sell"].value +sel
                          form.master3.rowset.next()
                        enddo  
                    form.entryfield10.value = sel
          else
             form.entryfield10.value = 0.00
          endif
          
     cnt = 0
          sel = 0.00  
          cnt = form.master4.rowset.count()
          form.entryfield1.value = cnt
          if cnt # 0
          do while not form.master4.rowset.endofset
                     sel = form.master4.rowset.fields["sell"].value +sel
                          form.master4.rowset.next()
                        enddo  
             form.entryfield2.value = sel
          else
             form.entryfield2.value = 0.00
          endif
          
     cnt = 0
          sel = 0.00
          cnt = form.master5.rowset.count()
          form.entryfield5.value = cnt
          if cnt # 0
          do while not form.master5.rowset.endofset
                     sel = form.master5.rowset.fields["sell"].value +sel
                          form.master5.rowset.next()
                        enddo  
              form.entryfield6.value = sel
                        else
                        form.entryfield6.value = 0.00
                endif
          
          sel = 0.00
          cnt = form.master6.rowset.count()
          form.entryfield7.value = cnt
          if cnt # 0
             do while not form.master6.rowset.endofset
                     sel = form.master6.rowset.fields["sell"].value +sel
                          form.master6.rowset.next()
                        enddo  
              form.entryfield8.value = sel
              else
              form.entryfield8.value = 0.00
          endif
          
          return

charlie Wrote:

> I am working on a work around now.  If anyone wants to see the entire code please let me know.  I am still thinking t his may be a windows or dbase problem.  Would love to be  proved wrong!!!
>
> charlie Wrote:
>
> > Hi Akshat.. I attached a picture of the error message in my last post.  
> >
> > Akshat Kapoor Wrote:
> >
> > > On 08.01.2020 14:31, charlie wrote:
> > > > Here it is... Another thing is that when this happens after I click on a button that causes it, looks like the program is doing something for a second before the error message appears.  The little windows circle appears for that second.  Also it forces a null .dbf to appear in the directory.  Named this or similar:  _QSQL518.DBF.
> > > >
> > > > Something similar happens in one other completely different form just after I push a button.  That happens only on the second, third or fourth time you push the button like this.  It never happens the first time you click, only on the second or more times.  But even when successful, you get a hesitation like it is doing something for a second even if successful..
> > > >
> > > > I have never looked into the other form error problem as I've been baffled on this.  Would be great to figure it out.
> > >
> > > _qsql???.dbf files are temporary files created when a query is run. They
> > > should be deleted when the form closes but at times they are left behind.
> > > I would request you to close all dbase applications and then search for
> > > and delete all _qsql files which are there in the directory in which
> > > this file appears.
> > >
> > > It would be very helpful if you send us the screen shots of error. No
> > > need to send whole desktop app (if that contains sensitive info) just
> > > the msgbox that displays the error is sufficient. But we need the exact
> > > message of error.
> > > Without the exact message it will be a blind shot.
> > > Regards
> > > Akshat
> > > >
> > > >
> > > > /
> > > > Akshat Kapoor Wrote:
> > > >
> > > >> On 08.01.2020 04:25, 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.
> > > >>>
> > > >>
> > > >> Requery() alone will never cause a problem. There is something else also
> > > >> involved. Will request you to paste a screenshot of the error message.
> > > >>
> > > >> Regards
> > > >> Akshat
> > > >
> > >
> >
>