InitRec

Method
Initializes a record.

Category
Records

 

Syntax
Sub InitRec(ByVal hTable As Long, ByVal hRec As Long)

hTable
The handle to the table.

hRec
The handle to the record that is to be initialized.

 

Example

'case "InitRec"

  createTestTable

  fillTestTable (2)

  CF1.OpenTable hTable, .Text1(cf.TableNoCreate).Text

  hRecord = CF1.AllocRec(hTable)

  CF1.BWT

  CF1.InitRec hTable, hRecord

  CF1.InsertRec hTable, hRecord

  CF1.EWT

  If CF1.RecCount(hTable) = 3 Then

  logWr "Initrec OK"

  Else

  logWr "Initrec failed"

  End If

  CF1.FreeRec hRecord

  CF1.CloseTable hTable

  deleteTestTable

 

Comments
InitRec assigns default values to each field in the record buffer. The values correspond to those that were defined when the table was created in C/SIDE. Fields for which no values were defined are assigned zero values.

After this operation has been performed, you are free to change the values in any or all of the fields before calling InsertRec to enter the record in the table. Ensure that the field(s) which make up the primary key contain values that make the contents of the total primary key unique. If the contents of the total primary key are not unique, the database manager will reject the record.



© 2009 Microsoft Corporation. All rights reserved.