"Invalid Object Format Name" in Crystal Reports

Posted by cmays90 on Stack Overflow See other posts from Stack Overflow or by cmays90
Published on 2013-10-23T15:06:02Z Indexed on 2013/10/23 15:54 UTC
Read the original article Hit count: 197

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about crystal-reports