Click to See Complete Forum and Search --> : resetting a crystal report control in code?
Spawny
Nov 8th, 2000, 02:44 AM
Hi,
I want to know if it is possible to reset the crystal reports control as I recieve an error when I try to swap between tables. What this means is that when i access 1 report using one table it loads the report but when i access anothter report with a different table it comes up with an error. Is there a command or code that will reset the control therefore allowing you to swap between tables.
Mike
marex
Nov 8th, 2000, 07:44 AM
Try this
I think of 2 solutions:
1. create a second CR control OR
2. change the CR properties by coding
sample: CrystalReport1.Datasource = your datasource
CrystalReport1.ReportFileName = your report
Hope this will help
Cheers
Ray
Ken Bradford
Nov 8th, 2000, 02:26 PM
Try this
Public Sub reSetDataFiles()
'This procedure is run before printing any Crystal Reports document.
'It takes care of the 20506 error.
frmMain.reportMain.DataFiles(0) = ""
frmMain.reportMain.DataFiles(1) = ""
frmMain.reportMain.DataFiles(2) = ""
frmMain.reportMain.DataFiles(3) = ""
frmMain.reportMain.DataFiles(4) = ""
frmMain.reportMain.DataFiles(5) = ""
frmMain.reportMain.DataFiles(6) = ""
frmMain.reportMain.DataFiles(7) = ""
frmMain.reportMain.DataFiles(8) = ""
frmMain.reportMain.DataFiles(9) = ""
frmMain.reportMain.DataFiles(10) = ""
End Sub
Spawny
Nov 9th, 2000, 03:43 AM
Marex,
Thanks but that doesn't work. The error I am getting is:
error "-214741848(80010108)"
Method 'Action' of object "CrystalCtrl" failed
Anyone else got ideas?
Spawny
Nov 9th, 2000, 04:43 AM
Sorry Ken,
That doesn't work either.
I have gone to microsoft and got the latest dev kit 2.6 and still no difference. I am using two forms but the first form uses one table and the other form uses the other.
I need them to run that way but there must be some way to fix the problem. I am using a form parameter though.
Mike
marex
Nov 9th, 2000, 04:50 AM
Hmmm
Very strange, I have many applications with more than
one CR control, no problems at all.
If you run the report from within CR itself, is it working
fine or not?
Which version of CR do you have, I'm using Version 7.
How is your coding inside the VB application.
Ones I had a problem, could'nt find anything, and just deleted the control and remaked it.
Cheers
Ray
Gary.Lowe
Nov 9th, 2000, 05:10 AM
Try putting a DoEvents before the ViewReport method of the control.
I have had problems before when trying to open another report after one has been opened.
It seems it is still processing when tring to view the new data.
Don't know if this will help but it's worth a try
Jeff Schultz
Aug 21st, 2001, 02:40 PM
Spawny,
Getting the exact same error. Were you ever able to figure out solution? Response greatly appreciated.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.