Insert
Applies to
VAccess
Description
Attempts to insert the current data buffer as a new record and returns, as an Integer value, the PSQL status code.
Syntax
object.Insert
The syntax for this method has the following parts:
 
Remarks
This method attempts to insert the current data buffer as a new record in the file associated with object, and returns the PSQL 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. PSQL status = " + _
Customers.Status
End Select