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!

TABLEREVERT() reverts too much

Status
Not open for further replies.

jrumbaug

Programmer
Apr 27, 2003
90
US
I am using VFP8.0. I am using a LOCAL VIEW. After editing an existing form with data, I have a button called SAVE. It does a :
TABLEUPDATE( 0 , .T. )
REQUERY("MyTableView")
If you leave the form by pressing ESCAPE or closing the form before pressing the SAVE button, it does:
TABLEREVERT(.F.,"MyTableView")

Here's my problem:

name = "me"
edit to = "YOU" && press save, shows "YOU"
edit to = "us" && press escape, shows "me" not "YOU"

How do I get the "buffer" to refresh to the SAVED info. I thought the TABLEUPDATE() & REQUERY() would do it.

Jim Rumbaugh
 

Jim,

Try doing two TABLEUPDATE()s -- one after the other. The first will commit the data to the view, the second will commit the view to the underlying table.

If the form is still active after the TABLEREVERT(), you also need to do a refresh, but that's not the cause of this specific problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike

Thank you very much for the "double update()" idea. But I'm embarrassed to say, I caused my own problem. After hacking at it again this morning, I found that I put my TABLEUPDATE() in a loop that handles new appended fields, not ones that were just being edited. I moved the TABLEUPDATE() to the correct position and now everything works. I consider this problem solved

Jim Rumbaugh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top