"Invalid Object Format Name" in Crystal Reports
- by cmays90
When working with Crystal Report Field Objects and attempting to set "EnableSuppress" to False or alter the position or width of a field object is generating an "Invalid Object Format Name" error. The debugger shows all my code running without error until attempting to actually load the report. At that point, it will run the first couple without problem, then it fails when messing with a field object, and none of the rest will run. The code is shown below. Everything that generates an error is a FieldObject, but not all fieldObjects generate errors. In the code below, everything in Section2 is a TextObject and everything in Section3 is a FieldObject.
If condition = True Then
'Lines marked as runs ok, only run when a line that generates an error is not present before it.
Report.Section2.ReportObjects("Text7").Left = 7830 'Runs ok
Report.Section3.ReportObjects("Field4").Left = 8085 'Runs ok
Report.Section2.ReportObjects("Text13").ObjectFormat.EnableSuppress = False 'Runs ok
Report.Section3.ReportObjects("Field28").ObjectFormat.EnableSuppress = False 'error
Report.Section2.ReportObjects("Text9").Left = 10830 'Runs ok
Report.Section3.ReportObjects("Field23").Left = 10830 'error
Report.Section3.ReportObjects("Field23").Width = 615 'error
Report.Section2.ReportObjects("Text10").Left = 11445 'Runs ok
Report.Section3.ReportObjects("Field25").Left = 11445 'Runs ok
End If