Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete already!
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00130334
Message ID:
00130439
Views:
21
>I have a grid with the delete mark active. When the user deletes a record, I want to go delete some other associated records and then delete the record the user wanted to delete.
>
>So, I put the other stuff I want it to do in the deleted event.
>
>That stuff works, but now it doesn't delete the record!
>
>I tried it with just the other code in there, tried doing the other code and then doing "dodefault", tried putting the delete code in myself after the other code, tried that last one and then doing a "nodefault" after it. Nothing works.
>
>It's not just that it's not deleting the record. It's acting strange. When I click on the delete mark, it blackens it, and also puts "XXXXX" for the tripnum field. But it doesn't actually delete it. If I go out and come back in to force refresh, sometimes it's still black, sometimes it's white again. If I click on it and say "no" to the "do you want to delete" question, which just does a "nodefault", It sometimes blackens it, sometimes completely deletes the record.
>
>This is crazy. Any ideas?
>
>-Michelle

Michelle:

Your code is in the right place. You need to have NoDefault at the end while deleting the child records AND the parent record in the grid. That is the only way I got this to work correctly for deleting records in a grid. Example:
if MessgeBox("Really Delete This Record?") <> 6
   NoDefault
   Return 0
endif
lnSelect = Select()
select ChildTable
delete while ChildTable.KeyID = ParentTable.KeyID
select (lnSelect)  && presumably the parent table
delete next 1
* Note: you may need to add code to move record pointer
*       off deleted record to remove it from view.
this.refresh() && refresh grid
NoDefault
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform