[RESOLVED] Need Help About Crystal Reports
hi, im new in this forum and im also a newbie in crystal reports. I want to display a particular records to crystal reports Im having a hard time viewing the report. this is my code but there's a problem
***************************
Dim rpt As Report
Dim obj As Form1
Dim rsuser As Recordset
Dim strsql As String
Set ocnn = New ADODB.Connection
ocnn.Open dbconnection
Set rsuser = New Recordset
Set rsuser.ActiveConnection = ocnn
strsql = "select * from customer"
rsuser.Open strsql, ocnn, adOpenKeyset, adLockReadOnly
If Not rsuser.EOF Then
While Not rsuser.EOF
rpt.DiscardSavedData 'The problem is right here
rpt.Database.SetDataSource (rsuser)
CR.ReportSource = rpt
rsuser.MoveNext
Wend
End If
rsuser.Close
Set rsuser = Nothing
************************************
the error msg states that , object variable or with block variable not set.
I dont know what to do. I dont know if my connection to database is correct or wrong... and also the components that i will going to add. i need ur help guys. thanx in advance
Re: Need Help About Crystal Reports
Welcome to the forums psychofoo. :wave:
I've never done it the way you are doing it. But, I think here is the problem.
You have created a variable called rpt and declared as type Report.
Yet, no where in your code to you Set it to equal an existing report, so when you try to DiscardData it doesn't know from where to discard it. At that point, rpt is simply an empty variable.
Re: Need Help About Crystal Reports
thanx for d reply... i set the rpt as new report but still there's a problem. what should i do know? actually, im a total newbie in crystal report.
i only want to display a record in a crystal report based on the sql command but i found it tough since i dnt have any knowledge abt crystal