CalcFields

Method
Updates FlowFields in a record.

Category
Records

 

Syntax
Sub CalcFields(ByVal hTable As Long, ByVal hRec As Long, ByVal FieldNoArray As Variant)

hTable
The handle to the table.

hRec
The handle to the record whose FlowFields are to be updated.

FieldNoArray
The array containing the numbers of the fields in hRec that are to be updated.

 

Example

 'case CalcFields

  CF1.OpenTable hTable, 15 'G/L Account

  hRecord = CF1.AllocRec(hTable)

  CF1.FindRec hTable, hRecord, "+"

  tmpVar = CF1.GetFieldData(hTable, hRecord, FlowFieldNo) 'The balance field

  logWr "Balance before CalcFields: " & tmpVar

  lngArray(0) = FlowFieldNo

  lngArray(1) = 0

  varArray = lngArray

  CF1.CalcFields hTable, hRecord, varArray

  tmpVar2 = CF1.GetFieldData(hTable, hRecord, FlowFieldNo)

  If tmpVar = tmpVar2 Then

  logWr "CalcFields failed"

  Else

  logWr "CalcFields OK. The balance is " & tmpVar2

  End If

  CF1.FreeRec hRecord

  CF1.CloseTable hTable

 

Comments
CalcFields evaluates any FlowFields in a record. A FlowField is a special C/SIDE feature that provides information from other tables in the database.

They are also known as virtual fields because their values are not saved with the table. FlowFields are only updated when CalcFields is called. For example, FlowFields in records that are accessed with FindRec and NextRec are set to zero. CalcFields must be called to update the values in the FlowFields.

A detailed explanation and illustration of FlowFields is available in the Application Designer's Guide.



© 2009 Microsoft Corporation. All rights reserved.