|
-
Jun 3rd, 2005, 12:44 AM
#1
Thread Starter
Member
[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
Last edited by psychofoo; Jun 5th, 2005 at 09:28 AM.
-
Jun 3rd, 2005, 07:13 AM
#2
Re: Need Help About Crystal Reports
Welcome to the forums psychofoo.
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.
-
Jun 4th, 2005, 03:52 AM
#3
Thread Starter
Member
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
Last edited by psychofoo; Jun 4th, 2005 at 04:09 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|