Вот пример того, как я устанавливаю значения формул для моего отчета об устаревании:
' Global Declarations
Public crxApp As CRAXDRT.Application
Public crxRpt As CRAXDRT.Report
Public crxTable As CRAXDRT.DatabaseTable
Public crxFormula As CRAXDRT.FormulaFieldDefinition
Раздел отчета об устаревании:
For Each crxFormula In crxRpt.FormulaFields
Select Case crxFormula.FormulaFieldName
Case CR_FORMULA_COMPANY_NAME
crxFormula.Text = QuoteIt(Trim(strCompanyName(1)))
Case CR_FORMULA_GROUP_1_HIGHLIGHT
crxFormula.Text = Replace$(strHCGroup(1), " ", "")
Case CR_FORMULA_GROUP_2_HIGHLIGHT
crxFormula.Text = Replace$(strHCGroup(2), " ", "")
Case CR_FORMULA_GROUP_3_HIGHLIGHT
crxFormula.Text = Replace$(strHCGroup(3), " ", "")
Case CR_FORMULA_GROUP_4_HIGHLIGHT
crxFormula.Text = Replace$(strHCGroup(4), " ", "")
Case CR_FORMULA_GRAND_HIGHLIGHT
crxFormula.Text = Replace$(strHCGrand, " ", "")
Case "Processing Date"
crxFormula.Text = "Date(" & QuoteIt(Format(dtpProcDate.Value, "Short Date")) & ")"
Case "Days Col 1"
crxFormula.Text = CStr(txtPeriod(0).Value)
Case "Days Col 2"
crxFormula.Text = CStr(txtPeriod(1).Value)
Case "Days Col 3"
crxFormula.Text = CStr(txtPeriod(2).Value)
Case "Days Col 4"
crxFormula.Text = CStr(txtPeriod(3).Value)
Case "Age Type"
Select Case True
Case optAgingType(0).Value
crxFormula.Text = QuoteIt(optAgingType(0).Tag)
Case optAgingType(1).Value
crxFormula.Text = QuoteIt(optAgingType(1).Tag)
Case optAgingType(2).Value
crxFormula.Text = QuoteIt(optAgingType(2).Tag)
Case optAgingType(3).Value
crxFormula.Text = QuoteIt(optAgingType(3).Tag)
End Select
Case "Summary"
crxFormula.Text = IIf(optReportType(1).Value, "True", "False")
End Select
crxFormula.Check blnFormulaOK, strFormulaErr
If Not blnFormulaOK Then
MsgBox CR_FORMULA_ERROR_TEXT & crxFormula.FormulaFieldName & vbNewLine & vbNewLine & _
strFormulaErr & vbNewLine & vbNewLine & _
Trim(crxFormula.Text), vbCritical, CR_FORMULA_ERROR_TITLE
Exit For
End If
Next crxFormula