rtCDP_ErrorNumber

Purpose
The members of this ENum are used in reporting error numbers for the object.

Syntax
Long = <rtCDP_ErrorNumber>

Members
rtCDP_ErrNoError (0)   No error has occured
rtCDP_ErrDatabaseFull (-1)   The database is full and cannot accept any additional records
rtCDP_ErrKeyTooLong (-2)   The specified key is too long to be valid
rtCDP_ErrDataTooLong (-3)   The specified data is too long to be valid
rtCDP_ErrRecordNotFound (-4)   The specified record cannot be found
rtCDP_ErrInvalidOptions (-10)   Invalid options were passed to the function
rtCDP_ErrPackageCorrupt (-140)   The data passed to the object is corrupt or is not CDP object data

Notes
The most common usage of this ENum will be in retrieving the current error number of the object using the ErrorNumber property.

Example
Objective: Demonstrate several usages of the rtCDP_ErrorNumber ENum.

'Create the object
Dim CDP As rtCDP.crtCDP
Set CDP = New
rtCDP.crtCDP
'Append a new record
CDP.Append "Name", "John Doe"

'This statement prints "0" (rtCDP_ErrNoError)
Debug.Print CDP.ErrorNumber

The current state of the database

Rec Key Data
0 Name John Doe


'Append a record with a key that is too long
CDP.Append String(256, "A"), "John Doe"
'This statement prints "-2" (rtCDP_ErrKeyTooLong)
Debug.Print CDP.ErrorNumber

The database remains unchanged

Rec Key Data
0 Name John Doe

'Insert a record in front of a record that does not exist
'The record "Zip Code" does not exist in the database
CDP.Insert "Address", "POB 1184", "Zip Code"
'This statement prints "True"
Debug.Print CDP.ErrorNumber = rtCDP_ErrRecordNotFound

Here are common ways the rtCDP_ErrorNumber ENum will be used

'Get the users first name from the "First Name" text box and
'put it in the database
.
CDP.Append "First Name", txtFirstName
'The user input is too long
If CDP.ErrorNumber = rtCDP_ErrDataTooLong Then
...MsgBox "First Name is too long"
End If

'Look up a record by its data.
'The user will enter the data to be searched for in a text box.
'The search will not be case sensitive, and the search will
'find partial matches, not just exact matches.
Dim RecNum As Long
RecNum = CDP.Find
(txtFind, rtCDP_FindWithin + rtCDP_FindNoCase)
'Check for errors
Select Case CDP.ErrorNumber
Case rtCDP_ErrDataTooLong

...MsgBox "The search string is too long"
Case rtCDP_ErrRecordNotFound
...MsgBox "The record was not found"
End Select

'Now add all the keys in a database to a list box

Dim C As Long
For C = 0 To CDP.Count - 1
...ListBox1.AddItem CDP.RecordKey(C)
Next C

Version History
1.0 2/20/2001 Tested

See Also
rtCDP_ErrorNumber