Discussion:
Command to determine if data hasn't been updated to the table
(too old to reply)
Doug Allan
2005-03-19 03:00:24 UTC
Permalink
I'm trying to find a command in VFP6 to do this but i'm sure if one exists.
I hope somebody can help me out.

Is there a command that tells me if there's any data in a table buffer that
hasn't been written to the table with the TABLEUPDATE() command? I want to
be able to ask the user if he wants to save the data when he hits the Close
button but only if there's been data that's been changed and not saved to
the table.

Thanks for your help.

Doug
Paul D
2005-03-19 10:29:30 UTC
Permalink
OLDVAL() Returns original field values for fields that have been modified
but not updated.
Post by Doug Allan
I'm trying to find a command in VFP6 to do this but i'm sure if one exists.
I hope somebody can help me out.
Is there a command that tells me if there's any data in a table buffer that
hasn't been written to the table with the TABLEUPDATE() command? I want to
be able to ask the user if he wants to save the data when he hits the Close
button but only if there's been data that's been changed and not saved to
the table.
Thanks for your help.
Doug
Doug Allan
2005-03-19 18:49:47 UTC
Permalink
Thanks for your help.

Doug
Post by Paul D
OLDVAL() Returns original field values for fields that have been modified
but not updated.
Post by Doug Allan
I'm trying to find a command in VFP6 to do this but i'm sure if one
exists.
Post by Doug Allan
I hope somebody can help me out.
Is there a command that tells me if there's any data in a table buffer
that
Post by Doug Allan
hasn't been written to the table with the TABLEUPDATE() command? I want to
be able to ask the user if he wants to save the data when he hits the
Close
Post by Doug Allan
button but only if there's been data that's been changed and not saved to
the table.
Thanks for your help.
Doug
Jürgen Wondzinski
2005-03-19 18:07:14 UTC
Permalink
Hi Doug,

put this code into the QueryUnload Event:

IF "2" $ GETFLDSTATE(-1) or "4" $ GETFLDSTATE(-1)
nAnswer = MESSAGEBOX("Do you want to save your changes and close the
Application?", 3+32,"Question")
DO CASE
CASE nAnswer = 6
TABLEUPDATE()
CASE nAnswer = 7
TABELREVERT()
OTHERWISE
NODEFAULT && Don't proceed with shut down
ENDCASE
ENDIF


Now, if you close your form with the "X" button, your user will
automatically gets askes. You surely will be able to adopt that to your
regular close button...
--
Servus

wOOdy

|\_/| ------ ProLib - programmers liberty -------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de and www.AFPages.com
-------------------------------------------------
Doug Allan
2005-03-19 18:49:23 UTC
Permalink
Thanks for your help. That's exactly what I was looking for.

Doug
Post by Jürgen Wondzinski
Hi Doug,
IF "2" $ GETFLDSTATE(-1) or "4" $ GETFLDSTATE(-1)
nAnswer = MESSAGEBOX("Do you want to save your changes and close the
Application?", 3+32,"Question")
DO CASE
CASE nAnswer = 6
TABLEUPDATE()
CASE nAnswer = 7
TABELREVERT()
OTHERWISE
NODEFAULT && Don't proceed with shut down
ENDCASE
ENDIF
Now, if you close your form with the "X" button, your user will
automatically gets askes. You surely will be able to adopt that to your
regular close button...
--
Servus
wOOdy
|\_/| ------ ProLib - programmers liberty -------
(.. ) Our MVPs and MCPs make the Fox run....
- / See us at www.prolib.de and www.AFPages.com
-------------------------------------------------
Ian Simcock
2005-03-20 02:17:05 UTC
Permalink
Hi Doug.

What you need to do depends on whether you have Row or Table buffering
Enabled.
For Row Buffering -
llUnsavedData = "2" $ GetFldState(-1) or "4" $ GetFldState(-1)

For Table Buffering -
llUnsavedData = (GetNextModified(0) # 0)

Hope that helps.

Ian Simcock.
Post by Doug Allan
I'm trying to find a command in VFP6 to do this but i'm sure if one exists.
I hope somebody can help me out.
Is there a command that tells me if there's any data in a table buffer that
hasn't been written to the table with the TABLEUPDATE() command? I want to
be able to ask the user if he wants to save the data when he hits the Close
button but only if there's been data that's been changed and not saved to
the table.
Thanks for your help.
Doug
Loading...