04 RecDelete - AndrewMB2/Logic-Architect-for-Excel-VBA GitHub Wiki

RecDelete method

Deletes the current record. Returns True if successful, otherwise false.

Applies to

TableData ArrData RsetData Xdata XShared

For RsetData, if there is an error, any update is cancelled.

The Record pointer (RecPos) or current record should not be referenced after a RecDelete operation. However in ArrData or RsetData, RecNext can be used to point to the record after where the deleted record would have been.

RecDelete is not implemented directly in TableData as deleting records is not compatible with the buffered processing used by the record procedures. It can be accessed through Xdata for compatibility (which ends record processing using RecClose and then deletes the row). However in order to delete rows, rather than use record level procedures, DeleteRows should be used directly.

Deleting a large number of records with RecDelete in ArrData or TableData (through DeleteRows) will generally not be the most efficient approach. In ArrData, Filter will generally be the most efficient. In TableData, the data can be transferred to an ArrData object, filtered and transferred back.

Record level procedures are used to process records individually in all Xdata objects. In the case of TableData, these record level procedures are buffered (100 worksheet rows at a time) which makes for very efficient sequential processing. However for random processing of datasets larger than 100 rows, this will be inefficient and it is better to use the Buffer, Value or Text properties.