Link to home
Start Free TrialLog in
Avatar of Altaf Patni
Altaf PatniFlag for India

asked on

RunTime Error 20525 "Unable to Load Report"

I have build crystal report in my project.
from vb6 form i am using following code to display report, but  getting RunTime Error 20525 "Unable to Load Report"

and highlighted on ".Action = 0"


Set Rs = Nothing
If Rs.State = 1 Then Rs.Close
Rs.Open "Select * from RawStock where SleePDate between '" & DTPickerFrom.Value & "' AND '" & DTPickerTo.Value & "'", con, adOpenKeyset, adLockOptimistic

If Rs.RecordCount > 0 Then

    With CrystalReport1
        
    .ReportFileName = App.Path & "\CrystalReport1.Dsr"
    .Connect = "DSN=crystal;UID=crystal;PWD=crystalABC;DSQ=cryst"
    .DiscardSavedData = True
    .Destination = crptToWindow
    .Action = 0
       
    End With
    
    End If

Open in new window

Avatar of Mike McCracken
Mike McCracken

YOu don't load dsr files that way.  You can only load rpt files.

mlmcc
Avatar of Altaf Patni

ASKER

changed to .rpt

still same problem
one more thing how to  bind record set ( RS ) with CrystalReport1.rpt

is it ok if i will use following line of code
CrystalReport1.SQLQuery = "Select * from RawStock where SleePDate between '" & DTPickerFrom.Value & "' AND '" & DTPickerTo.Value & "'"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial