Solved

Printing using Crystal Reports' object.printout (CRAXDRT?)

Posted on 2001-09-12
10
1,261 Views
Last Modified: 2009-12-16
Have a VB app that prints a report that has around 25 records in recordset rs. On several machines, it works fine (both development machines and true end-use machines). On a couple of machines, though, it acts as though it's going to print, and it even brings up the print dialog. The printer never activates, though. A 0 lenth job goes to the print queue, and then it disappears.

Using:
  rpt1.Database.SetDataSource rs, 3, 1
  rpt1.PrintOut

Any ideas?
0
Comment
Question by:pflugg
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 4

Expert Comment

by:trkcorp
ID: 6477749
Try monitoring for any error directly after your run command thusly:
If CrystalReport1.LastErrorNumber <> 0 Then MsgBox crystalreport1.LastErrorNumber & " " & crystalreport1.LastErrorString

Sometimes you get an error from the report engine and you will not know what it is unless you intercept it...
0
 

Author Comment

by:pflugg
ID: 6477770
I don't get a choice for lasterrornumber for my rpt object.

Dim rpt1 as new pcls.dsrLabels8160
(pcls is the project / dsrlabels8160 is the designer)

rpt1.database.setdatasource rs,3,1
rpt1.printout
rpt1. {this is where I assume lasterrornumber should go)

am I declaring something wrong?
0
 
LVL 17

Expert Comment

by:Suat Ozgur
ID: 6477911
I think there is a record source problem here. Do you have any chance to open reports in original application (say in Crystal Reports) and preview there (at the machines that reports doesnot run)? Or did you try target as Window instead of Printer directly to see if records are retrieved or not for each computer?

suat
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6478442
Do you have diff. datasource for each machine, or you use the same datasource/database for all machines you tested? I mean the location.
0
 

Author Comment

by:pflugg
ID: 6479282
The datasource is actually a recordset in memory. I know it's building the recordset, but I'm still not getting any output. Code follows:

Private Sub cmdPrint_Click()

 Dim rs As New ADODB.Recordset
 Dim dblRollCounter As Double
 Dim dblExposureCounter As Double
 Dim rpt1 As New PCLS.dsrLabels8160
 Dim rpt2 As New PCLS.dsrLabels8161
 Dim rpt3 As New PCLS.dsrLabels8162
 
 On Error GoTo PROC_ERR

 If Val(txt_lngNumberOfRolls) <= 0 Or Val(txt_lngNumberOfExposuresPerRoll) <= 0 Or Val(txt_dblLastRoll)
<= 0 Then
   VBA.MsgBox "Number of Rolls, Exposures Per Roll and First Roll Number Must Be Valued", vbOKOnly,
"Error"
 Else
 
 'create the fields for the reporting rs
 
 With rs.Fields
    .Append "strLine1", adVarChar, 40
    .Append "strLine2", adVarChar, 40
    .Append "strLine3", adVarChar, 40
    .Append "strLine4", adVarChar, 40
    .Append "strLine5", adVarChar, 40
 End With
 
 rs.Open
   
 'populate the reporting rs
   
 For dblRollCounter = Val(txt_dblLastRoll) To Val(txt_dblLastRoll) + Val(txt_lngNumberOfRolls) - 1
   For dblExposureCounter = 1 To Val(txt_lngNumberOfExposuresPerRoll)
     rs.AddNew
     rs("strLine1") = "Copyright (c) " & Year(VBA.Date) & "By: "
     rs("strLine2") = Trim(Me.txt_strLabelLine2)
     rs("strLine3") = Trim(Me.txt_strLabelLine3)
     rs("strLine4") = Trim(Me.txt_strLabelLine4)
     rs("strLine5") = "(Negative #: " & dblRollCounter & " / " & dblExposureCounter
     If chk_PrintASuffix Then
       rs("strLine5") = rs("strLine5") & "A)"
     Else
       rs("strLine5") = rs("strLine5") & ")"
     End If
     rs.Update
   Next
 Next
 
 'print the report
   
  Select Case lngReportFormat
  Case 8160
      rpt1.Database.SetDataSource rs, 3, 1
      rpt1.PrintOut
  Case 8161
      rpt2.Database.SetDataSource rs, 3, 1
      rpt2.PrintOut
  Case 8162
      rpt3.Database.SetDataSource rs, 3, 1
      rpt3.PrintOut
  End Select
 
  Set rs = Nothing
  Set rpt1 = Nothing
  Set rpt2 = Nothing
  Set rpt3 = Nothing
 
  txt_dblLastRoll = Val(txt_dblLastRoll) + Val(txt_lngNumberOfRolls)
   
 End If
 
 Exit Sub

PROC_ERR:
 MsgBox "The following error occurred: " & Error$
 Resume Next

End Sub
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 17

Expert Comment

by:Suat Ozgur
ID: 6479353
C a n  y o u  r e a d  s o u r c e  d a t a b a s e  f r o m  t h a t  c o m p u t e r  y o u  h a v e  t r o u b l e?


Because i think problem is accessing data file from those computers. If code runs for other machines then it means no problem in code.

Suat
0
 

Author Comment

by:pflugg
ID: 6479362
It's in memory so I'm not really reading it from a physical location.
0
 
LVL 9

Expert Comment

by:Valliappan AN
ID: 6479379
Did you try VerifyOnEveryPrint setting to true for the report?
0
 

Author Comment

by:pflugg
ID: 6482844
Did some error trapping. Get "PHYSICAL DATABASE NOT FOUND" message on the Win2000 machine, which is wild, since there's no physical database. The recordset is created and right before the report goes to print, if I display rs.recordcount, the appropriate number of records is shown. Any ideas?
0
 
LVL 9

Accepted Solution

by:
Valliappan AN earned 100 total points
ID: 6484732
I think for your report, you have linked to some db when designing the report, from one m/c. Since that db is there, it works for that m/c. Then you go to another m/c and try running the report, since that db is not there in the Win 2000 m/c, may be it is giving that error.

Just set the Crystal report's db path also, in runtime, if there is such an option in the report object.

I am not sure yet, if this is the problem.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

929 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now