Click to See Complete Forum and Search --> : Very strange runtime 424 error.


mctree
August 1st, 2005, 07:24 AM
Hello all,

My project is using VB6 and Crystal Reports 8.5

In this project I wish to retrieve data from access database, then I have two options: to display the result with Crystal Reports, or to save as a local text file. So the code I wrote as follows:

'Opt_ReportMode is radio buttons, here CrystalReports is selected
If Opt_ReportMode(0).Value=True Then
With LogRpt 'CrystalReports Component
.ReportFileName="a.rpt"
.Connect="some database file"
.DiscardSavedData=True
.RetrieveDataFiles
.ReportSource=0
.SQLQuery="some sql sentence"
.Destination=crptToWindow
.PrintFileType=crptToWindow
.Action=1
End With

'if save to local text file option is selected
Else
'Here I use CommonDialog Component for file choosing
With cdSaveFile
.CancelError=True 'yes, I do have errhandler
.InitDir="."
.Filter=...
.ShowSave
End With
... some other operation, which I commented all, but the error still there
End If

After compiling when I ran this program, and I first chose display with crystal report, it worked fine. Then I chose save to local file, also fine. But, when I switch back to crystal report option, I got a run-time error 424: Object Required. The error is caused by ".retrievedata"

I can display crystal report several times with different data and there is no problem until I choose to save as local file once. I'm totally confused by this problem and hope you can help me.

Many Thanks!

Regards,
m.c.

mctree
August 1st, 2005, 07:33 AM
Problem solved...

My stupid mistake...sigh

Anyway, I find a good place here

Madhi
August 3rd, 2005, 05:19 AM
Where did you make mistake?