Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling same report in a loop creates problems

Status
Not open for further replies.

rchandr3

Programmer
Jun 16, 2003
244
US
hi everybody,

I have a VB active X dll which creates the same crystal OCX report in a loop for showing and printing.

problem 1: if i call the report in a loop, for the second time, it says sql server cannot be opened...may be the first report instance still persists...how to kill that instance or how to overcome this problem

problem 2: when i create an instance of this activex control in vb standard exe and run it the report gets displayed for a second and then closes automatically. if destination is printer then printing is done successfully. why and how to solve this??

your help would be highly appreciated!

thanks in advance
 
Have you tried using the Crystal RDC instead of using the OCX control? It is very easy to use from VB and I think you'll have much better luck.

Create the Crystal Application object.
Load the report using an OpenReport() call.
Enter Loop
Clear Data
Set Report Parameters, etc.
Print Report
Loop

(You may have to add extra steps in there to refresh the data, etc)

The Crystal Application object will keep the SQL server connection open and you shouldn't have any problems with the SQL connection.

I'm not sure I understand what your second problem is, can you be more specific?

I posted a helpful Tip a while back that has some quick syntax to get you started.


Jeremy
 
Thanks a lot, Jeremy

I solved it myself w/o using RDC. I am dreaded to use RDC as I hav no exp in that!

I solved that by using logonserver and logoffserver methods!

Ravi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top