Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete records in grid and compute total
Message
 
 
To
04/10/2004 07:05:45
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00947104
Message ID:
01217083
Views:
26
Hi Marcia,

I seem to have some strange problem with the first record in the grid. It doesn't want to disappear after I deleted it!

Any ideas of resolving the problem?

Thanks in advance.

>i put this code under at procedure deleted,but nothing happend.
>
>The problem with putting this code in the DELETED() event is that the record is not deleted until the method ends. So, what you may want to do instead, is create a custom method on your form called DeleteRecord and put code like this in the grid's DELETED() method:
>
>
>Thisform.DeleteRecord( nRecNo )
>NODEFAULT
>
>
>and put this code into the form's deleteRecord method:
>
>
>LPARAMETERS tnRecNo
>LOCAL lcAlias, loColumn
>lcAlias = Thisform.Grid1.recordSOurce
>GO tnrecord IN ( lcAlias )
>IF DELETED( lcAlias )
>  RECALL IN ( lcAlias )
>  *** Move record pointer to refresh grid
>  SKIP IN ( lcAlias )
>  SKIP -1 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	
>  *** Need to move record pointer to refresh display
>  SKIP IN ( lcAlias )
>  IF EOF( .RecordSource )
>    GO BOTTOM IN ( .RecordSource )
>  ENDIF	
>ENDIF
>
>*** Now call your code to change all the item numbers here
>
>*** Refresh the grid by setting focus to it
>*** Find out which column is the first column
>FOR EACH loColumn IN Thisform.Grid1.Columns
>  IF loColumn.ColumnOrder = 1
>    loColumn.SetFocus()
>    EXIT
>  ENDIF
>ENDFOR
>
>
>Change This:
>
>SUM TOTAL TO THISFORM.TEXT13.VALUE>
>
>to This:
>
>Thisform.Text13.Value = lnRecCount
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform