Deleting a row from a DataGrid
Using a data environment (MS Jet 4.0 DB Provider). Have set up commands for
each of the 4 tables (not using SQL statements). In frmMain, have DataGrid
control with source of deTransfers & member of Location (1 of the tables
The control includes all rows (fields) of the Location table, as it should.
Have written procedures to add, edit, & delete a row. Using code below, when
user deletes a row, gets error . . . "Row handle referred to a deleted row
or a row marked for deletion." HOWEVER, when I step through (F8), execution
does not stop! Works fine. Row gets deleted from record set & DB! When I
do not step through & execution halts & I press Debug, execution is on the
line following .Delete.
What is going on? Thanks for any suggs.
private Sub mnuDeleteLocation_Click()on error GoTo HandleError With deTransfers.rsLocation
.Delete 'Delete the current record .MoveNext 'EXECUTION stops
here (after .Delete) when NOT debugging - Move to the following record
If .EOF then 'If last record deleted
.MovePrevious If .BOF then 'If BOF and EOF true, no records
remain MsgBox "The recordset is empty.", vbInformation, "No records"
End If else: .MoveFirst End If End With Exit
Sub HandleError: MsgBox "Unable to carry out requested action.", vbInformation,
"Video Bonanza" on error GoTo 0End Sub
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center