Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 7.0: Substituting a cursor for a table makes the form crash

Status
Not open for further replies.

Kimed

Programmer
May 25, 2005
104
0
0
LT
Hi,

I have an application where I need the form to display a grid consisting of fields from several tables AND some additional fields that don't exist in any physical tables and only make sense in this particular form (and, sadly, they *can't* be simulated by calculated fields). The idea is, I create a cursor with all necessary fields and then call the form. To debug the form in stand-alone mode, I created a physical table using a SQL SELECT operator taken directly from the calling program so that its structure would be identical to the cursor I'll be using in real work. While debugging, everything went perfectly, but once I try to call the form from the upper-level program, VFP crashes to the desktop without any warnings or even vfp7err.log records.

It's even more weird: I set a breakpoint on the SELECT ... INTO CURSOR operator, run the program, once it stops I copy the SELECT into the command window without any changes, then issue DO FORM from the command window and it runs with the cursor I just created by hand. Then I make a single step in debugger, allowing the program to create *exactly* the same cursor, issue another DO FORM, and it crashes.

What's most frustrating, I already used that "cursor-substituting-for-table" method previously, and it worked all right. But apparently there's some underwater rock somewhere I didn't take into account this time.

Thanks for any theory on what might be happening.

AutoOpenTables and AutoCloseTables properties of the form are set to False, DataSession is Default.
 
I have no idea what's happening. A form wouldn't even just crash in the way you describe, if no cursor was present to show in the grid. It would either error or show a blank grid.

A thing making a form disappear is returning .F. from it's Load() or Init() event.

Debug what's happening in Load and Init with breakpoints there. If there is no code in Load or Init put a Dodefault() in these events and add a breakpoint there, code might be in a form class that form is based on.

Bye, Olaf.
 
Kimed,

What exactly do you mean when you say "VFP crashes to the desktop without any warnings"?

Do you mean the program hangs? Or it says that it "has encountered an error and needs to close"? Or it invokes your error-handler? Or what?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Like Mike above I could use more clarity on the exact nature of your problem.

But here is a problem that I have found over time that MIGHT be applicable.

First I build my Grid's Cursor or Temp Data Table in the Form's LOAD Method - otherwise it might not be 'seen' by the Form.

BUT if my Grid has specifically defined Column ControlSource's and my Cursor (or temp data table) does not have one of these fields EXACTLY as defined in each and every one of the Column ControlSource's, then the entire Form just "blinks out and totally disappears" with no error message and it usually shuts down my VFP as well.

Good Luck,
JRB-Bldr
 
I wonder if there might be confusion with the data sessions.

For example the form is using data session 1 and the cursor is being created in data session 2, except when you create it via the command window where it is being created in data session 1. Because the cursor is not in the needed data session for the form, the form is "not happy"

Lion Crest Software Services
Anthony L. Testi
President
 
Thank you everybody. Problem solved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top