Solved

Report not printing

Posted on 2002-06-07
7
654 Views
Last Modified: 2006-11-17
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
Comment
Question by:mnord
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 7063891
Replace

crysControl.PrintReport

with

crysControl.Action = 1

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

mlmcc
0
 

Author Comment

by:mnord
ID: 7067018
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
 

Author Comment

by:mnord
ID: 7067429
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
Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

 
LVL 4

Accepted Solution

by:
trkcorp earned 200 total points
ID: 7068532
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
 
LVL 100

Expert Comment

by:mlmcc
ID: 7069769
What does your query look like?

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

mlmcc
0
 

Author Comment

by:mnord
ID: 7069979
trkcorp:

You answered this in the other group.

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

mnord
0
 
LVL 4

Expert Comment

by:trkcorp
ID: 7070034
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question