Purpose
Used to delete a record from the database.
Syntax (Method)
object.DeleteRec
Index
| Index
(Long) |
|
This
is the record number of the record you want to delete.
This
parameter is zero-based (the first record is record number zero).
|
Notes
If the specified record exists, the record is deleted and the ErrorNumber
property returns rtCDP_ErrNoError.
If
the specified record does not exist, no records are effected and the
ErrorNumber
property returns rtCDP_ErrRecordNotFound.
If
any errors occur, no records are effected.
Error
Values
After calling this function, the property ErrorNumber
will report one of the following values:
rtCDP_ErrNoError
rtCDP_ErrRecordNotFound
Example
Objective: Append and then delete a record from the database.
'Create
a database
Dim CDP As
rtCDP.rtCompactDataPak
Set CDP = New rtCDP.rtCompactDataPak
'Add
some records to the database
CDP.Append "Name", "Kathy"
CDP.Append
"Name", "Susan"
CDP.Append
"Name", "Beth"
This
is the current state of the database:
| Rec |
Key |
Data |
| 0 |
Name |
Kathy |
| 1 |
Name |
Susan |
| 2 |
Name |
Beth |
'Now,
delete a record in the database
CDP.DeleteRec
0
This
is the current state of the database:
| Rec |
Key |
Data |
| 0 |
Name |
Susan |
| 1 |
Name |
Beth |
'Now,
delete a non-existent record in the database
CDP.DeleteRec
1000
'nothing changes
This
is the current state of the database:
| Rec |
Key |
Data |
| 0 |
Name |
Susan |
| 1 |
Name |
Beth |
Version
History
1.0 10/27/2001 Tested
See
Also
DeleteAll,
Delete,
DeleteArray