Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete record
Message
De
20/04/2004 09:36:45
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00896462
Message ID:
00896465
Vues:
7
>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)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform