|
-
Aug 23rd, 2000, 07:09 AM
#1
Thread Starter
Fanatic Member
Hi everybody
I have a report set up in VB6 which is attached to an access query.
I want to be able to specify certain criteria to search on before the report opens.
This is what I have so far
Code:
Dim Report As New ImportDesigner
Private Sub Form_Load()
sSQL = "SELECT * " _
& "From tblImport " _
& "WHERE " _
& "Import_Date=#8/22/2000#;"
'Open the recordset
Set rstTemp = New ADODB.Recordset
rstTemp.CursorType = adOpenKeyset
rstTemp.LockType = adLockBatchOptimistic
rstTemp.Open sSQL, cnnMIS
'This section is meant to set the report data source to the recordset.
Report.Database.SetDataSource rstTemp
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Now the report works but brings back everything as in the original query and seems to ignore the code to set the data source to the recordset.
Does anybody have any ideas.
Thanks
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Aug 23rd, 2000, 07:31 AM
#2
Lively Member
Rusty but.....
I'm a little rusty on Crystal and when I did use the blessed thing it was with an Informix Db.
I had similar problems though and no matter what you thought it should be displaying it displayed the original report. First off I assume you did de-select the 'save data with report' option?
The way around this problem that I used was to set up a formula field - just a blank one. And then within the 'selection formula' set up, in your case the date to be equal to the formula field. Within VB before calling the report you set the formula field to be equal to your date. Can't recall syntax, something like, "crystalrep.formula(0) = '@date = ' & yourdate"
Hope this hasn't been completely useless!
Anakim
It's a small world but I wouldn't like to paint it.
-
Aug 30th, 2000, 08:30 AM
#3
Member
i don't know if your problem is solved, but here you find a possible solution
http://forums.vb-world.net/showthrea...threadid=27353
Greetings !
-
Aug 30th, 2000, 09:36 AM
#4
Hyperactive Member
There is an option on the file menu in Crystal - 'Save data with report' or something like that. You might want to check that that was not checked when you last saved the report otherwise the report will not refresh.
-
Aug 30th, 2000, 09:48 AM
#5
Thread Starter
Fanatic Member
I am only using the Crystal reports data control.
I found if I use the wizard part to create the main report and then butcher it, it then let me specify the data source.
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Aug 30th, 2000, 09:53 AM
#6
Lively Member
I had that exact same problem with Crystal once too. I called them up and this is what they suggested I do. Along with de-selecting the "Save data with report option" I also put this in code when doing the report.
CR1.ReportFileName = App.Path & "\REPORT.rpt"
CR1.DiscardSavedData = True
CR1.WindowState = crptMaximized 'optional of course
CR1.Action = 1
Hope thhis helps.
-
Aug 30th, 2000, 09:56 AM
#7
Lively Member
Oh sorry I forgot to say. That you use that code I posted along with whatever code you use to pull records for the report. But you probably knew that.
-
Aug 30th, 2000, 11:12 AM
#8
Hyperactive Member
I posted some code for someone else here:
http://forums.vb-world.net/showthrea...threadid=22060
I think it may have something to do with the way you're declaring your report object variable
Dim Report As New ImportDesigner
I always use
Code:
Dim Report As ImportDesigner
Set Report = New ImportDesigner
...
I hope this helps.
-
Aug 31st, 2000, 03:42 AM
#9
Thread Starter
Fanatic Member
Thanks Everybody.
I installed the application to the network lastnight and ran all but the report functions. Everthing has worked fine with the exception of the reports.
On the PC it was installed on it worked fine but if I try and access it from another PC I get the following error.
430: Class does not support automation or does not support expected interface.
Does anybody have any idea what this is?
When the application is installed any dll's, ocx's are installed to the app path. There should'nt be anything installed on the pc.
As I said earlier everthing else works. When the report is accessed the error is diplayed but the form will open but not display anything.
Can you help?
Thanks
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Aug 31st, 2000, 07:52 AM
#10
Hyperactive Member
Try reinstalling the lastest mdac on the problem system. If that doesn't work install dcom98.
-
Sep 18th, 2000, 09:09 PM
#11
Lively Member
Originally posted by ande211
I had that exact same problem with Crystal once too. I called them up and this is what they suggested I do. Along with de-selecting the "Save data with report option" I also put this in code when doing the report.
CR1.ReportFileName = App.Path & "\REPORT.rpt"
CR1.DiscardSavedData = True
CR1.WindowState = crptMaximized 'optional of course
CR1.Action = 1
Hope thhis helps.
Hi there,
As a Crystal report expert, I hope you could help me this beginner.
I want to do a very simple thing. When the user presses the command button, the crystal report has to opened in the crystal report program,
Any help would be greatly appreciated.
Thank you.
sincerely,
Rathi.J
-
Sep 22nd, 2000, 09:28 AM
#12
Lively Member
Originally posted by Gary.Lowe
Hi everybody
I have a report set up in VB6 which is attached to an access query.
I want to be able to specify certain criteria to search on before the report opens.
This is what I have so far
Code:
Dim Report As New ImportDesigner
Private Sub Form_Load()
sSQL = "SELECT * " _
& "From tblImport " _
& "WHERE " _
& "Import_Date=#8/22/2000#;"
'Open the recordset
Set rstTemp = New ADODB.Recordset
rstTemp.CursorType = adOpenKeyset
rstTemp.LockType = adLockBatchOptimistic
rstTemp.Open sSQL, cnnMIS
'This section is meant to set the report data source to the recordset.
Report.Database.SetDataSource rstTemp
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Now the report works but brings back everything as in the original query and seems to ignore the code to set the data source to the recordset.
Does anybody have any ideas.
Thanks
Hi Gary,
I'm trying to do the same thing, that is passing a parameter to the crystal report.
I tried to copy your code (hope you don't mind). But I don't know, how to declare the ImportDesigner object.
I am stuck up with this for the past few days. Hope you could help me.
So, how can can I declare the ImportDesigner? How did you refersh the data in the report?
Thanks for your valuable time and support.
Rathi
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
|