Printing reports in the VB UI is pretty straight forward and fairly well documented. You specify the report name in the RptName() function. Example: RptName = "XXREPT01"
Then, create a section in the report descriptor file (the xxrpt.ini file) with the same name. The report descriptor file defines things like the parameters for the report. You have probably noticed that if you don’t have a section in the xxrpt.ini file with the correct report name, you get prompted for all the report parameters when printing the report.
By the way, I don’t think it’s specifically stated anywhere, but the report name has to start with the module prefix. Otherwise the UI can’t find the report descriptor and you get prompted for the parameters. So, a report name of “MYREPORT” won’t work – it must be “XXMYREPORT”.
But what if you want to allow the user to select a different / custom crystal report? Let’s say you have a text box called txtReport on the UI where the user can enter a custom report name. Just doing something like this won’t work: RptName = txtReport.Text
The UI won’t be able to find the report descriptor and the user will be prompted for parameters. There is an undocumented solution though. Simply keep the original report name and append the custom report name in square brackets to the string like this: RptName = "XXREPT01[" & txtReport.Text & "]"
This will allow the UI to find the report descriptor and will override the “crystal=“ line in the descriptor file with the custom file name.
Happy Coding!
John Paterson, CEO at Dingosoft
Visit my blog and find Dingosoft on Social Media: