ValidateTable

Use this event to implement a validation rule for the entire table.

Syntax

<Fieldn>_ValidateTable (pTable as ISCBCdrTable, pWorkdoc as ISCBCdrWorkdoc, pValid as Boolean)
Parameter Description
pTable Table object
pWorkdoc Current workdoc object.
pValid Parameter containing the current valid state of the table.

Sample Code

Private Sub MyTableField_ValidateTable (pTable as SCBCdrPROJLib.SCBCdrTable, pWorkdoc as SCBCdrPROJLib.SCBCdrWorkdoc, pValid as Boolean)
   'calculate the sum of all amounts and compare with the net amount fields
   Dim tablesum as double, netamount as double
   Dim cellamount as double
   Dim row as long
   For row = 0 to pTabler.RowCount-1
      cellamount = CLng(pTable.CellText("Total Price", Row))
      tablesum = tablesum + cellamount
   Next row
   'now compare sum with the content of the net amount field
   netamount = CDbl(pWorkdoc.Fields("NetAmount").Text
   if netamount = tablesum then
      pValid = TRUE
   else
      pValid = FALSE
      pTable.TableValidationErrorDescription ="Sum of table amounts and field net amount are different"
   end if
End Sub