>If TableUpdate(.T.,.T.,'vDetail') = .F.
> Tablerevert('vDetail')
> Wait Window ' Save record Failed! ' timeout 3
>Else
> Tableupdate(.T.,.T.,'Codes')
> Requery('vCodes')
> Requery('vDetail')
>Endif
This is a little apart from your main concern; but please note that, since TableUpdate() already returns a logical value, you don't need to compare it to
another logical value to get a logical expression.
You can use:
if not TableUpdate(...)
or:
if ! TableUpdate(...)
Also, you might prefer to re-arrange your code to avoid the not (put the affirmative first):
if TableUpdate(.T., .T., 'vDetail')
Tableupdate(.T.,.T.,'Codes')
Requery('vCodes')
Requery('vDetail')
else
Tablerevert('vDetail')
Wait Window ' Save record Failed! ' timeout 3
endif
Another note: you can use transactions to save "All or nothing". RTFM, under: BEGIN TRANSACTION, END TRANSACTION, ROLLBACK. Please note that only tables that are part of a database can participate in a transaction.
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)