Re: VFP8, Grid crashing when line item is clicked by Dan
Dan
Mon Aug 29 11:19:46 CDT 2005
The two forms are the only two in use. I start the program up, click a
button from a menu and the Data Entry form opens. The data entry form does
not share any common database with the search form. The search form simply
returns the value of the selected item.
I could see the problem with having a shared database across two forms.
This is not the problem in this case. I like your thinking... its
something off the wall causing this.. I don't know..
I was able to add code to the Error event that traps for Cursor/Table not
available. If the error occurs the Search form is closed automatically.
This is not a solution, but it does prevent the user from freezing up from
my untrapped error.
Any other ideas??
Thx again,
Dan
"Allan" <Allan@discussions.microsoft.com> wrote in message
news:E4CFF052-E797-4EC0-A943-BCD6BB40EA2E@microsoft.com...
> Hi Dan,
>
> This must have something to do with the DataSession property of your form.
> Try to set the property to 2 - Private Data Session on both forms and
drap a
> copy the table on both DataEnvironment of the forms. Save the primary key
on
> the search form when it closes by using the return value during UnLoad,
the
> use that to Seek the value in the calling form to do the necessary
updating...
>
> Just a thought, hope this will help...
>
> Allan
>
> "Dan Tallent" wrote:
>
> > Another thought,
> >
> > you are correct ... it errors on the search form.
> >
> > I put code into the Error event on the search form. This is how I
trapped
> > the message and line number.
> >
> > * Error Event
> > LPARAMETERS nError, cMethod, nLine
> >
> > MESSAGEBOX("Error M:"+cMethod+" E:" + ALLTRIM(STR(nError)) + " L:" +
> > ALLTRIM(STR(nLine)))
> >
> > local clTempfileSS
> > clTempFileSS= revnum+'SS'
> >
> > MESSAGEBOX("TempFile: " + clTempFileSS + IIF(USED(clTempFileSS)=.t.,"Is
> > Currently in use","Is not available"))
> >
> >
> >
> > *
> > It reported "Currently in use"
> >
> > So the table is not closing...
> >
> > Any other ideas?
> >
> > Thx
> >
> > Dan
> >
> >
> >
> >
> >
> >
> >
> > "Tim Witort" <trw7at@ixdot.netcomdotcom> wrote in message
> > news:Xns96BD7158B8E9Ctimwitortwrotethis@207.217.125.201...
> > > Dan Tallent seemed to utter in
> > > news:OlJpOjYqFHA.3352@TK2MSFTNGP14.phx.gbl:
> > >
> > > > I have a grid that sits on the form. One of the columns is for
Part
> > > > Number.
> > > > This grid is used for (data entry)
> > > >
> > > > I have a seperate table that list the all known part numbers. I
have a
> > > > search form that list the part numbers of this other table. This
> > > > search form has a grid of its own.
> > > >
> > > > This setup allows the user to simply enter a known part number,
double
> > > > click to fire the search form, or hit the question mark from the
> > > > keyboard to fire the search form.
> > > >
> > > > When the user double-clicks, everything works great. The search
form
> > > > opens, the user picks one part number from the search form. It then
> > > > fills in the row I was on with the selected value.
> > > >
> > > > The problem is when I use the "?" question mark to fire the search
> > > > form. When the search form opens, it list the first 10 hits starting
> > > > from the top of the Part Number file.
> > > > As soon as I click the grid on the search form, the program crashes.
> > > >
> > > > Error # 52, Line 0, Method: Grid1.mousedown
> > > > No table is open is the current work area.
> > >
> > > So the error occurs in the search form when you click on that
> > > grid, correct? There does not need to be code in this grid's
> > > mousedown in order for an error to be raised (as you can see by
> > > the telltale "line 0" in the error message). It looks like
> > > the contents of the search grid are not being setup or maintained
> > > correctly. When you give focus to the grid by clicking on it,
> > > VFP wants to move the record pointer of the grid's controlSource
> > > to the corresponding record. If the controlSource cursor/table
> > > has been closed or is inaccessible in the form's dataEnvironment,
> > > you will get such an error.
> > >
> > > -- TRW
> > > _______________________________________
> > > t r w 7
> > > at
> > > i x dot n e t c o m dot c o m
> > > _______________________________________
> >
> >
> >