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
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