• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 664
  • Last Modified:

Report not printing

I am using VB 6 Enterprise with Crystal
Reports 8.5. I am using the OCX control. On
the development machine, the report will
print fine when I execute the code. On
another machine, we installed the executable
and all of the associated dlls that Crystal
uses and the app needs using the application
setup wizard application. On this machine,
the report will not print at all. However,
other crystal reports that are in this app
will print from this machine.

The code that I am executing looks like the
following:
crysControl.DataFiles(0) = App.Path
& "\FDRdb.mdb"
crysControl.ReportFileName = App.Path
& "\rptMiscCashReceipt.rpt"
crysControl.SQLQuery = sSQL
crysControl.CopiesToPrinter = 2
crysControl.Destination = crptToPrinter
crysControl.PrintReport

Is there anything special that you have to
do to make PrintReport work?

The other reports that print correctly are
those that require user interaction because
they are previewed using the Crystal
controls.
The code is similar to:
crysControl.ReportFileName = App.Path
& "\rptInitialBill.rpt"
crysControl.WindowState = crptMaximized
crysControl.Action = 1

This application only uses the OCX control.

Thanks for any help.
0
mnord
Asked:
mnord
  • 3
  • 2
  • 2
1 Solution
 
mlmccCommented:
Replace

crysControl.PrintReport

with

crysControl.Action = 1

In theory these are the same but I have better luck with the latter.

mlmcc
0
 
mnordAuthor Commented:
When I change the PrintReport command to Action = 1, the users are getting a SQL server related error and the problem is that the database is actually Access.

mnord
0
 
mnordAuthor Commented:
When I change the PrintReport command to Action = 1, the users are getting a SQL server related error and the problem is that the database is actually Access.

mnord
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
trkcorpCommented:
If this is related to the other question I answered it may already be fixed but anyhow, I find it very useful to include a crystal error trap in my code like this:

crysControl.PrintReport
'look for & report crystal error
If crysControl.LastErrorNumber > 0 Then _
    MsgBox crysControl.LastErrorNumber & ": " & crysControl.LastErrorString

This will retrieve the crystal error which is not reported any other way and deliver it to you for analysis.  If there is no error then nothing happens, ie, no MsgBox.
0
 
mlmccCommented:
What does your query look like?

You use sSQL in the program.  There may be something wrong with it.

mlmcc
0
 
mnordAuthor Commented:
trkcorp:

You answered this in the other group.

I didn't have the ODBC DSN setup on the test machine.

mnord
0
 
trkcorpCommented:
I suspected that, but you still might want to stick that error trap right after the .printreport because it has saved my bacon more than once, especially after it is installed on the user's machine and something gets squirrelly...  Like I said, the print engine will very often encounter an error and "handle" it without ever reporting it to you.  Result: darn thing doesn't work and it gives no clue as to why.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now