Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete records in grid and compute total
Message
De
05/10/2004 15:28:01
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00947104
Message ID:
00948898
Vues:
36
hi,
thank you for reply.

this is the code under what i must change or add, mytable name is(temp)
This code goes in the DeleteRecord() method:


LPARAMETERS tnRecNo
LOCAL lcAlias, loColumn
lcAlias = Thisform.Grid1.recordSOurce
*** The current record may not be the one we are trying to delete, that is,
*** the paramter to the deleted() method (nRecoNo) may not be the same as RECNO()
*** and if we just added it, RECNO( .RecordSource ) WILL be a negative number but nRecNo 
*** will be a positive one! So if you are using table buffering and not TABLEUPDATEing
*** the grid's RecordSOurce until later, you need more checks before you just GO tnRecNo
GO tnRecNo IN ( lcAlias )
IF DELETED( lcAlias )
  RECALL IN ( lcAlias )
ELSE	
  DELETE IN ( lcAlias )
  *** Must do a TableUpdate as soon as the record is deleted. Otherwise,
  *** when it is recalled, you will get a PK violation 
  IF ! TABLEUPDATE ( 0, .F., lcAlias )
    MESSAGEBOX( 'Unable to Update Table', 48, 'So Sorry!' )
  ENDIF	
ENDIF
SELECT ( lcAlias )
COUNT TO lnRecCount FOR NOT DELETED()
lnItemno = 0
SCAN FOR NOT DELETED()
  lnItemno = lnItemno + 1
  REPLACE Itemno WITH lnItemno
ENDSCAN
THISFORM.TEXT13.VALUE = lnItemNo
This code goes in the grid's Deleted) method. No other code should be in the deleted method():


LPARAMETERS nRecNo
This.DeleteRecord( nRecNo )
NODEFAULT
thanks.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform