|
-
Oct 22nd, 2006, 09:34 AM
#1
Thread Starter
Addicted Member
[RESOLVED] VB Error opening CR 4.6.0.1
I'm having some trouble opening the correct report using VB6. There are 2 reports (so far). If I simply use:
CrystalReport1.PrintReport the first report I created is printed no matter how many reports I may have.
I then created a second report called "TeamStat.rpt" and wish to open it. Using this code I get an error "Object variable or With block variable not set"
With CrystalReport1
.ReportFileName = App.Path & "\TeamStat.rpt"
.Action = 1
End With
Can someone shed some light on this for me?
TIA
Ken
-
Oct 22nd, 2006, 10:19 AM
#2
Re: VB Error opening CR 4.6.0.1
Do you have control on your form with the name CrystalReport1 ?
-
Oct 22nd, 2006, 10:33 AM
#3
Re: VB Error opening CR 4.6.0.1
Check that you have the crystal report control on the component and add it. You are using the crystal report control in your project so on the crystal report in the VB how to use it in the VB?, Get the crystal report tutorial from my signature. Link is given at my signature.
-
Oct 22nd, 2006, 11:26 AM
#4
Thread Starter
Addicted Member
Re: VB Error opening CR 4.6.0.1
Thank you for the replies RB and Shakti. Turns out the problem was that I didn't have the control on the form. I got the code from your tutorial, Shakti.
However, how do I pass a SQL statement to the report? For instance, if I only want players from TeamID = 22 to be printed? Normally it would be something like
"Select * from Players where [TeamID] = " & 22 & " order by [avg] desc"
Thanks guys ... step by step I'm learning ...
Ken
-
Oct 22nd, 2006, 11:53 AM
#5
Re: VB Error opening CR 4.6.0.1
Check the post 2,3 on my tutorial where I give an example related to the SQL query.
-
Oct 22nd, 2006, 12:00 PM
#6
Thread Starter
Addicted Member
Re: VB Error opening CR 4.6.0.1
Thanks Shatki ... it's a little different from what I'm used to, but a little experimenting solved it.
Thanks again.
Ken
-
Oct 22nd, 2006, 09:29 PM
#7
Re: VB Error opening CR 4.6.0.1
You are welcome
If you got the solution then go to the thread tool menu and resloved this thread
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
|