
Changing a formula @ Run Time - Report Designer Component
I am using VB 6.0 & the Report Designer Component
Can anybody help me with this code:
Dim app As CRAXDRT.Application
Dim rpt As CRAXDRT.Report
Dim defs As CRAXDRT.FormulaFieldDefinitions
Set app = New CRAXDRT.Application
Set rpt = app.OpenReport(strMyPath)
Set defs = rpt.FormulaFields
defs.Item("FormulaName").Text = """new formula"""
I get a "type mismatch error" in the last line. If I use a numeric index,
it works (but I have to know the numeric index for the formula).
On line help says:
Item Returns FormulaFieldDefinition Object. Item has an index parameter that
"can be either a string reference to the formula field or a numeric, 1-based
index."
When a numeric index is used, the items in the collection are indexed in
the order they were added to the report.
Instead of using the Item property as shown, you can reference a formula
field directly, for example, FormulaFieldDefinitions("ExampleFormula").
Anybody have any idea what I am doing wrong here?
--
Brian Beninger