IF .m_get_MemoData(psData,psGrpId) *Handle the ADO stuff oConn = CREATEOBJECT("ADODB.Connection") oConn.ConnectionString = "Provider=VFPOLEDB.1;Data Source="+oApp.DbfPath+";Password=''" oConn.Open() oRs = CREATEOBJECT("ADODB.RecordSet") oRs.Open("Select * FROM memoinfo", oConn) IF OCCURS("pn",LOWER(psDoc))>0 oRs2 = CREATEOBJECT("ADODB.RecordSet") oRs2.Open("Select * FROM memodata", oConn) ENDIF && OCCURS("pn",LOWER(psDoc))>0 *create Crystal Reports object oCR = CREATEOBJECT("CrystalRuntime.Application") IF TYPE('oCR') <> 'O' .p_Message = .p_Message+CHR(13)+'m_Vfp_To_Cr() COULD NOT ACCESS Crystal Reports Application object !' llContinue = .F. ELSE *create the report object oRpt = oCR.OpenReport(lsMemo_Location) IF TYPE('oRpt') <> 'O' .p_Message = .p_Message+CHR(13)+'In m_Vfp_To_Cr(), '+ALLTRIM(psDoc)+' CRYSTAL REPORT report object NOT created !' llContinue = .F. ELSE oRpt.Database.Tables.Item(1).SetDataSource(oRs) * if memoPn.rptmemosub.rpt, with the property numbers, * do not print, it will print with memopn.rpt IF OCCURS("pn",LOWER(psDoc))>0 oSub = oRpt.OpenSubreport("memosub.rpt") IF TYPE('oSub') <> 'O' .p_Message = .p_Message+CHR(13)+'In m_Vfp_To_Cr(), '+ALLTRIM(psDoc)+' CRYSTAL REPORT report object NOT created !' llContinue = .F. ELSE oSub.Database.Tables.Item(1).SetDataSource(oRs2) ENDIF && TYPE('oSub') <> 'O' ENDIF && OCCURS("pn",LOWER(psDoc))>0 ENDIF && TYPE('oRpt') <> 'O' ENDIF && TYPE('oCR') <> 'O' * in case data was saved with the report, remove it * so the correct data source will be used IF oRpt.HasSavedData oRpT.DiscardSavedData() ENDIF * open printer prompt to print oRpt.PrintOut() IF .p_Error > 0 llContinue = .F. ENDIF && * reset ole object to off to save overhead oRs.Close IF TYPE('oRs2')='O' oRs2.Close ENDIF && oConn.Close oCr.CanClose oSub = null oRpt = null oCr = null RELEASE oCR,oRpt,oSub,oConn,oRs,oRs2 SET OLEOBJECT OFF ELSE *message provided in m_Get_MemoData() llContinue = .F. ENDIF && .m_get_MemoData(pcGroupId) RETURN llContinue