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

Reversing an Append Blank

Status
Not open for further replies.

Serincino

Programmer
Jun 13, 2003
61
US
I have a form that when it is called automatically opens a blank record in the database it uses (Append Blank). My question is that is a user were to accidently click the button that opens this form and then they click cancel, how do I revert the table to get ride of the blank record?

I use TableRevert(.t.) in the cancel button, but when I shutdown the application it comes up with the message that data has been changed in the database would I like to save? I ran into this error before when I changed data in tables or added records and found that TableUpdate(2,.f.) fixes that issue to save changes I want made.

As a side note to anyone using VFP 8.0 like I am. I found that even if you have Multilocks off VFP 8.0 still buffers and the TableUpdate() is required to save changes in databases during runtime else it will ask the user if they would like to save changes when they close the app, at least it does this when using VFP databases.

I would greatly appreciate anyones help on this issue since it have been bugging me for 2 days now.

-Serincino
 
Cerincino,

1 easy way to avoid the problem is to create a popup (via messagebox() f.e) asking the user if he really wants to add a new record ...

x=messagebox("Are you sure",1+32+256)
if x=0
append blank
else
return
endif

wilfredo
(why make things more difficult than necessary?)
 
Serincino,

What you are describing is not default behaviour. VFP 8.0 does not prompt you to save changes when you close down. If you have buffering enabled and there are unsaved edits when you close down, the edits are automatically committed.

The prompt to save unsaved edits must be coming from your application, probably from the ON SHUTDOWN routine or the form's QueryUnload. You will have to find the relevant code, and modify it so that doesn't prompt you if there are no unsaved edits.

On your point about multilocks, VFP 8.0 is the same as other versions, in that it does require multilocks to be on for buffering. I suspect that it is defaulting to having multilocks on, probably because of the setting in the Data tab of Tools / Options.

Mike




Mike Lewis
Edinburgh, Scotland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top