>hmm so I looked at your code I always read buffering was to protect data during updating never quite got that part .Also i dont really follow your save code....nor do i trust mine
I'll copy the save code again, for reference, and add some more comments.
if not TableUpdate()
local laError[1]
aerror(laError)
MessageBox("Error code: " + trans(laError(1)) + " - Error message: " + laError(2), 16, "Error saving data")
endif
TableUpdate() will try to save the record. It will return .T. if you can save, .F. if you can't. Here is a simpler version:
if not TableUpdate()
MessageBox("Can't save for some reason.")
endif
However, you want to give the user more specific information about what went wrong. Some reasons why a TableUpdate() can fail is because a trigger failed (due to referential integrity, or some other rule that doesn't allow you to save changes), because the table is read-only, a field-level rule or a record-level rule is violated, you try to insert duplicate data (duplicate according to a primary or candidate index), and several others more.
If an error occurs, you collect information, with the function aerror(). The function collects information about the error to an array, which I called laError. This array has 5 elements, but only the first two are interesting in most cases: the error number, and the error message. This information is then shown as an error message, with the function MessageBox().
HTH,
Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)