I looked at the snipet of code placed by pcjock and hope this is a solution to a problem i am facing. I am by no means a crystal or vb expert, I will qualify myself as a novice, (sql server and database programming been the areas ). I would like to use this code, as a sample, to develop a small app to be called from ctd 2000 application to print a crystal report programatically from either crystal 8 or 9. The ctd can print to crystal but i find it limiting specially in passing variables to apps, the biggest problem been date variables. What libraries do i need to include in the code below to be able to print reports from a vb app. My idea, with your permission to use his code as a guide, is to initialize the printer, either normal printer or amyuni pdf converter in the vb app, pass parameters to the app, print the report and then release the printer driver. Can anybody help. I am at end of my rope trying to resolve this problem with very little knowledgde of vb or crystal.
This snippet is by pcjock ( a contributor to this site and it was posted on may 12 2003 in the programmer's forum).
Dim Viewer AS CRAXDRT.Application
Dim Report AS CRAXDRT.Report
Set Viewer = New CRAXDRT.Application
Set Report = Viewer.OpenReport("XYZ.rpt"
Report.SelectPrinter pDriverName, pPrinterName, pPortName
Report.PaperOrientation = crLandscape
Report.PrinterDuplex = crPRDPHorizontal
Report.ParameterFields.Item(1).AddCurrentValue 52446
Report.ParameterFields.Item(2).AddCurrentValue -1
Report.DisplayProgressDialog = True
Report.Database.Tables(1).SetLogOnInfo "MyServer", "MyDatabase", "User", "Pwd"
Report.PrintOut True
Set Report = Nothing
Set Viewer = Nothing
This snippet is by pcjock ( a contributor to this site and it was posted on may 12 2003 in the programmer's forum).
Dim Viewer AS CRAXDRT.Application
Dim Report AS CRAXDRT.Report
Set Viewer = New CRAXDRT.Application
Set Report = Viewer.OpenReport("XYZ.rpt"
Report.SelectPrinter pDriverName, pPrinterName, pPortName
Report.PaperOrientation = crLandscape
Report.PrinterDuplex = crPRDPHorizontal
Report.ParameterFields.Item(1).AddCurrentValue 52446
Report.ParameterFields.Item(2).AddCurrentValue -1
Report.DisplayProgressDialog = True
Report.Database.Tables(1).SetLogOnInfo "MyServer", "MyDatabase", "User", "Pwd"
Report.PrintOut True
Set Report = Nothing
Set Viewer = Nothing