LOCAL oCR LOCAL oRpt LOCAL oDB LOCAL ocDBT LOCAL oDBT LOCAL oConn LOCAL oRS * Handle the ADO stuff oConn = CREATEOBJECT("ADODB.Connection") oConn.ConnectionString = "Provider=MSDASQL.1;driver={SQL Server};SERVER=Server;DATABASE=DRI_DRI;UID=user;PWD=pass" oConn.Open() oRS = CREATEOBJECT("ADODB.RecordSet") oRS.Open("Select * FROM Borrower", oConn) *Test that there's data - there is WAIT "Field = " + oRS.Fields['LOANNO'].Value WINDOW oCR = CREATEOBJECT("CrystalRuntime.Application") oRpt = oCR.OpenReport("i:\driwin_css\driwin_cs\reports\crystal\borrower.RPT") * Create the Database object oDB = oRpt.Database() * Get a references to the DatabaseTables collection ocDBT = oDB.Tables() * Get a reference to the DatabaseTable object for table 1 oDBT = ocDBT.Item(1) * Pass the Record Set to Crystal Reports oDBT.SetDataSource(oRS) IF oRPt.HasSavedData oRPT.DiscardSavedData() ENDIF oRpt.PrintOut()>Under the hood, the viewer control uses the RDC. So, you'll do everything that I posted, then instead of doing a printout, you'll hook up the viewer control. Look at the Crystal Reports article on my web site as it has code for using the viewer control too.
ocDBT = oDB.Tables()
>>but I "thought" you had created the variable as an object before that assignment. I got confused by the VFP7 intellisense code because I have no idea about it... thought you were doing VB, so my apologies.