Help me please!
Hi, im using CR8.5 (RDC), VB6, Access 2000, Windows 2000.
(I try to set a recordset as source of a report at runtime.)
I have a form where the user can select criteria for a report. I then construct a dynamic report with the recordset constructed with the criteria. So the user can preview a report, then close the report, choose others criteria, preview the new report, etc.
Im using DiscardSavedData method to refresh the data with the following code :
Dim Report As New CrystalReportMembersList
Dim Recordset As ADODB.Recordset
Set Recordset = New ADODB.Recordset
Recordset.Open request, _
db, adOpenDynamic, adLockOptimistic
Report.DiscardSavedData
Report.Database.Tables(1).SetDataSource Recordset, 3
The first report that is print is always OK. But for the second (or third, or fourth, etc) report that is print, I sometimes got the following error :
Method 'DiscardSavedData' for Object 'Report' failed
So sometimes the program will crash at the 2nd report, sometimes the 3rd, sometimes the 10th report, sometimes the program never crash...
Ive also try to check "Discard saved Data when Loading reports" in "Default Settings" but it didnt work.
How should I use the Discardsaveddata method ? Who else is using it ? And if you don't use it, what do you do to refresh your data ?
thanks,
Frank