Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can view the report but cannot print... Help!

Status
Not open for further replies.

Dino1975

Programmer
Jan 24, 2002
6
MY
Hello,

I am using a RDC on a VB to print the report. This is my coding.

Dim reportdELIVERYoRDER As New RptAPDeliveryOrder
Dim total_i, total_ii As Double
Dim REF, PAYMENTTERM, TOTAL_STR, txtd As String
Dim CompName, RegNo, Add1, Add2, Add3, Add4, Poscode, Tel, Fax, Email, Web As String


rst.Open "Select * from main.company where id='" & db & "' ", cnn, adOpenForwardOnly, adLockBatchOptimistic
If rst.RecordCount > 0 Then
CompName = rst!Name
RegNo = rst!RegNo
Add1 = rst!Add1
Add2 = rst!Add2
Add3 = rst!Add3
Add4 = rst!Add4
Poscode = rst!Poscode
Tel = rst!TelR
Fax = rst!TelF
Email = rst!Email
Web = rst!Web
End If
rst.Close
rst.Open (sql_cmd), cnn, adOpenForwardOnly, adLockBatchOptimistic

reportdELIVERYoRDER.DAtabase.SetDataSource rst
If rst.RecordCount > 0 Then
If preview_print = True Then
CRViewer1.ReportSource = reportdELIVERYoRDER
End If
reportdELIVERYoRDER.ParameterFields.GetItemByName("compname").AddCurrentValue CompName
reportdELIVERYoRDER.ParameterFields.GetItemByName("regno").AddCurrentValue RegNo
reportdELIVERYoRDER.ParameterFields.GetItemByName("add1").AddCurrentValue Add1
reportdELIVERYoRDER.ParameterFields.GetItemByName("add2").AddCurrentValue Add2
reportdELIVERYoRDER.ParameterFields.GetItemByName("add3").AddCurrentValue Add3
reportdELIVERYoRDER.ParameterFields.GetItemByName("add4").AddCurrentValue Add4
reportdELIVERYoRDER.ParameterFields.GetItemByName("poscode").AddCurrentValue Poscode
reportdELIVERYoRDER.ParameterFields.GetItemByName("tel").AddCurrentValue Tel
reportdELIVERYoRDER.ParameterFields.GetItemByName("fax").AddCurrentValue Fax
reportdELIVERYoRDER.ParameterFields.GetItemByName("email").AddCurrentValue Email
reportdELIVERYoRDER.ParameterFields.GetItemByName("web").AddCurrentValue Web
reportdELIVERYoRDER.ParameterFields.GetItemByName("customer").AddCurrentValue customer
Screen.MousePointer = vbDefault
reportdELIVERYoRDER.PrinterSetup Me.hwnd
If preview_print = True Then
CRViewer1.ViewReport
DoEvents
CRViewer1.Zoom 100
Else
reportdELIVERYoRDER.PrintOut (True)
Unload FrmPreview
End If
End If
rst.Close




the problem I found is that, the system set this report to no printer. I had to run printer setup (refer to last 11th line) to disable "No Printer" in order to print to the printer. Need help... to by pass printer setup or some area which I go wrong
 
the sintax for te printout method is

object.printout promptuser, number of copies, colalted, starpagenumber, stop page number

if you dont especify all the parameters may be you can be able to print.

if you want to print the report you must supress the

crviewer1.reportsource = report
and
crviewer1.viewreport

lines


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top