>How can create a button in a form to delete the record
>of a table where I am at that moment ?
Assuming you have buffering, the code would be similar to this:
delete
if not TableUpdate()
MessageBox("Não posso apagar o registro!")
return
endif
skip
if eof()
go bottom
endif
ThisForm.Refresh()
I strongly recommend that you use buffering; however, if you don't, omit the part from
if not TableUpdate() to the corresponding endif.
Also, many programmers who are relatively new to VFP are tempted to PACK at that moment; don't do this: it is slow, and doesn't work on a shared table. Instead, use SET DELETED ON to hide deleted records; do the PACK once a month at midnight, with a special maintenance program.
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)