Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete record
Message
From
20/04/2004 09:36:45
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00896462
Message ID:
00896465
Views:
8
>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!")
  * Further analysis with aerror()
  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)
Previous
Reply
Map
View

Click here to load this message in the networking platform