To postpone the validation - and for other reasons - you should use buffering. (Another important reason is to let the user undo changes easily.) With buffering, the triggers won't be evaluated until changes are saved.
To enable buffering, put the following in Form.Init():
Cursorsetprop("Buffering", 5)
When user does changes and then clicks on a "Save" button, try to confirm the changes with TableUpdate()
if not TableUpdate()
local laError
aerror(laError)
MessageBox("Can't save changes; error number " + trans(laError(1) + chr(13) + chr(10);
+ "Message: " + laError(2))
endif
If the user clicks on a "Cancel" button, the corresponding command is:
TableRevert()
CursorSetProp("Buffering"), TableUpdate() and TableRevert() all have additional parameters for the alias, but I was assuming you work with only one alias.
HTH,
Hilmar.
>I have RI condition like following:
>
>RI Condition Parent Table Child Table Update Delete Insert Parent Tag Child Tag
>
> t004 t077s Restrict Restrict Restrict ktopl
>
>In BROWSE mode, as soon as I add a record with Ctrl-Y, the empty record is validated. I have triggers. I receive the error message (trigger failed).
>
>With View | Append mode, the record update (and validation) is postponed until we go to the next record.
>
>In form, I am facing same problem while executing append blank.
>
>The code is:
>
>SELECT t077s
>llSuccess=CURSORSETPROP("Buffering", 5, "t077s")
>APPEND BLANK IN ('t077s')
>thisform.SetAll('readonly',.f.,'Textbox')
>thisform.SetAll('readonly',.f.,'Combobox')
>thisform.cboKtopl.SetFocus()
>thisform.refresh()
>
>Please help me how to write code properly in form.
>
>Regards,
>
>Swarup Modak
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)