The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
|
|
Deleting one record from a grid
Posted: 15 Nov 06 10:06 AM
|
fiogf49gjkf0d When I use the below script it deletes all records in the grid. What am I doing wrong here? I just need to delete the one that is selected. These are not yet saved in the database.
With grdGuests.Recordset If Not (.BOF And .EOF) Then .MoveFirst For i = 0 To .RecordCount - 1 If .Fields("KEYFIELDID").Value = strKeyFieldID Then .Delete End If .MoveNext Next End If End With |
|
|
|
Re: Deleting one record from a grid
Posted: 15 Nov 06 10:28 AM
|
fiogf49gjkf0d Hi David,
If these are not yet saved in the database then does the KEYFIELDID field really have a value? Maybe it is blank causing the IF block to be true for all records? That is the only thing I can come up with that would make sense.
-Ryan |
|
|
|
Re: Deleting one record from a grid
Posted: 15 Nov 06 10:33 AM
|
fiogf49gjkf0d Yes, I am assigning the keyfieldid when adding the record to the grid. Maybe my problem is not that it is deleting all records but maybe the gridrs is not getting updated correctly. I will kick it a few more times. |
|
|
|
Re: Deleting one record from a grid
Posted: 15 Nov 06 1:29 PM
|
fiogf49gjkf0d I was barking up the wrong tree. It was not my deletion script causing the problem. Found my issue by adding some message boxes to walk thru the firing order. A lot of events were firing and one of them called the griddefinition routine that of course wiped it out. I tweaked the events to correclty handle this.
|
|
|
|