select * from pvendor into dbf temp1 USE DO FORM PrintSelection WITH "myreport.RPT","temp1"Now in the INIT method of form "PrintSelection" has following code:
PARAMETER cRep, cData tReport = sys(5)+sys(2003)+"\"+cRep tFILE1 = sys(5)+sys(2003)+"\"+cData WITH This .oCrystalReports = CREATEOBJECT("CrystalRuntime.Application") .oReport = .ocrystalreports.OpenReport(tReport) .AddObject("oleCRViewer", "oleControl", "crViewer.crViewer") ENDWITH crdata = ThisForm.oReport.Database crtables = crdata.tables crtables.item(1).name = cDATA crtables.item(1).location = tFILE1 crparm = ThisForm.oReport.parameterFields crparm.item(1).setcurrentvalue(cCutDate) WITH This.oleCRViewer .Top = 1 .Left = 1 .Height = ThisForm.Height - 2 .Width = ThisForm.Width - 2 .ReportSource = ThisForm.oReport .ViewReport() ENDWITHThis runs fine first time, but when I click the preview button second time I gets the error at SELECT line that "File access is denied"