Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE Object gets corrupt on 2nd run in VFP9 only on Windows 7

Status
Not open for further replies.

vedamin

Programmer
Aug 24, 2021
5
IN
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()

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top