PreviousActiveX Controls Guide (9.1 revision 1) Next

Insert

Show this topic in Library frames

Applies to:

VAccess

Description

Attempts to insert the current data buffer as a new record and returns, as an Integer value, the Pervasive.SQL status code.

Syntax

object.Insert 
 

Part
Description
object
Required. The object placeholder represents an object expression that evaluates to an object in the Applies To list.

Remarks

This method attempts to insert the current data buffer as a new record in the file associated with object, and returns the Pervasive.SQL status code from the operation. A return value of zero indicates success. A return value of 5 indicates that the record could not be inserted because a field or fields in the data buffer used in a key or keys defined for the file which do not allow duplicate values, contain values of another record already in the file.

If you want to perform a no-currency-change operation, use the KeyNumber property .

Example

'Search for record, if it does not exist, insert it 
'Set the search values 
Customers.FieldValue("name") = "John Adams" 
'Set the index and do the search 
Customers.IndexNumber = 1    'customer name 
Customers.GetEqual 
'If the record does not exist, insert it 
Select Case Customers.Status
Case 0
     MsgBox "The customer entry already exists."
Case 4
     Customers.Insert
Case Is > 0
    MsgBox "Error. Pervasive.SQL status = " + _ 		 
		Customers.Status 
End Select 

Chapter contents
Publication contents

Prev topic: Init
Next topic: Open