GetFieldData

Method
Use this function to retrieve data from a field.

Category
Fields

 

Syntax
Function GetFieldData(ByVal hTable As Long, ByVal hRec As Long, ByVal FieldNo As Long) As Variant

hTable
The handle to the table.

hRec
The handle to the record from which you want to retrieve field data.

FieldNo
The number of the field from which you want to retrieve data.

 

Example

' loop through records

  CF1.FindRec hTable, hRecord, "-"

  tmpLong2 = 1 'used to count no of records

  tmpLong = CF1.GetFieldData(hTable, hRecord, 1)

  Do While tmpLong <> tmpLastRecord

  tmpVar = CF1.NextRec(hTable, hRecord, 1)

  If VarType(tmpVar) <> vbInteger Then

  logWr "NextRec failed. It didn't return an Integer"

  End If

  tmpLong = CF1.GetFieldData(hTable, hRecord, 1)

  tmpLong2 = tmpLong2 + 1

  Loop

  logWr "Stepped through " & Trim$(Str$(tmpLong2)) & " records. Data from the last one: " + Str$(tmpLastRecord)

 

  CF1.FreeRec hRecord

 

Comments
GetFieldData is the preferred way to retrieve data from a field in a record, in order to store it in a variable for further processing. The data is returned as the data type Variant.

See also GetFieldDataArray.



© 2009 Microsoft Corporation. All rights reserved.