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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can the opening of a view be aborted?

Status
Not open for further replies.

SSSMan

Programmer
Sep 16, 2003
8
US
I have several local views that are used to print reports that at times can retrieve thousands of records based on criteria entered by the user.

My question is, is there a way that the USE command that opens the view can be interrupt without generating an error?

Thanks, David
 

My question is, is there a way that the USE command that opens the view can be interrupt without generating an error?

It depends, are you trying to open the view in the same form? If it is a different form, make them private datasession.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
David,

Do you mean that you want to give the user a way of deliberately interruptin the table opening? (A "Cancel" button, in other words)? If so, I can't see how that's possible. The USE is a single statement. There would be nowhere for you to insert a test for the cancel button. Nor could you rely on the user hitting ESC (with SET ESCAPE ON), as that too only tests for the keystroke between commands.

The only solution I can think of is to do away with the views, and instead programmatically create a cursor by looping through the records in the base tables. You can then test for the ESC key or Cancel button inside the loop. But that would probably slow the whole thing down a lot, and would mean a lot more code. You'll have to decide if it's worth it.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hi
Maybe something like:
Code:
lcErrorSetting = on('error')
on error lCancel = .t.
set escape on

use {your_view}

set escape off
on error &lcErrorSetting

 
Badukist,

I don't believe that will work, partly for the reasons I mentioned above, and partly because it will interrupt the entire program or method, not just the single statement. But I might be wrong about that.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Mike,
This works on remote views
I've tested with a remote view which have 15000 rows and a small program that open it few times.
Only about 5000 rows was downloaded each time.

Code:
lcOnEscape = on('escape')
on escape lCancel = .t.

USE {view}

on escape &lcOnEscape

but I don't think that will work on local views.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top