Following is a simple piece of code. It fails on 2nd run only on Windows7 but runs well on Windows 8 and 10.
The only solution is to quit VFP9 and run the code again.
oCR = CREATEOBJECT("CrystalRuntime.Application")
oRpt = oCR.OpenReport(FULLPATH('')+"SAMPLE.RPT")
oConn = CREATEOBJECT("ADODB.Connection")
oConn.ConnectionString = "Provider=vfpoledb;Data Source="+ FULLPATH('')+";Collating Sequence=general;"
oConn.Open
oRS = CREATEOBJECT('adodb.recordset')
oRS.Open("SELECT * FROM SWDAT.DBF", oConn)
oRpt.Database.SetDataSource(oRS) && Throws Error on 2nd run : OLE Object may be corrupt
oRpt.Database.Tables.Item(1).Parent.Verify()
The only solution is to quit VFP9 and run the code again.
oCR = CREATEOBJECT("CrystalRuntime.Application")
oRpt = oCR.OpenReport(FULLPATH('')+"SAMPLE.RPT")
oConn = CREATEOBJECT("ADODB.Connection")
oConn.ConnectionString = "Provider=vfpoledb;Data Source="+ FULLPATH('')+";Collating Sequence=general;"
oConn.Open
oRS = CREATEOBJECT('adodb.recordset')
oRS.Open("SELECT * FROM SWDAT.DBF", oConn)
oRpt.Database.SetDataSource(oRS) && Throws Error on 2nd run : OLE Object may be corrupt
oRpt.Database.Tables.Item(1).Parent.Verify()