Purpose
Used to delete a record from the database.
Syntax (Method)
object.Delete
Key
| Key
(String) |
|
This
is the key of the record you want to delete. |
Notes
If the specified record exists, the record is deleted and the ErrorNumber
property returns rtCDP_ErrNoError.
If
multiple records exist matching the specified key, the first record
with a matching key 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_ErrKeyTooLong
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.Data("Name") = "Amanda"
CDP.Data("Address") = "123 Main St"
This
is the current state of the database:
| Rec |
Key |
Data |
| 0 |
Name |
Amanda |
| 1 |
Address |
123
Main St |
'Now,
delete a record in the database
CDP.Delete
"Name"
This
is the current state of the database:
| Rec |
Key |
Data |
| 0 |
Address |
123
Main St |
'Now,
delete a non-existent record in the database
CDP.Delete
"Phone Number"
'nothing changes
This
is the current state of the database:
| Rec |
Key |
Data |
| 0 |
Address |
123
Main St |
Version
History
1.0 1/30/2001 Tested
See
Also
DeleteAll, DeleteArray,
DeleteRec