Strange shift position of Printer.Print
- From: hon123456 <peterhon321@xxxxxxxxxxxx>
- Date: Tue, 18 Mar 2008 02:01:35 -0700 (PDT)
Dear all,
I have used printer.print method to printe some text, I have
fixed the position. In the begining, the print out is ok. But after a
while, the print out position is shift and not in right place.
What happened. By the way, I am not fmailiar with English. Please
suggest me some keyword to
search of this problem in this newsgroup. Thanks.
Private Sub cmdPrint_Click()
Dim Cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Cnn.ConnectionString = "Provider=SQLOLEDB.1;Password=sa;Persist
Security Info=True;User ID=sa;Initial Catalog=Express;Data
Source=10.129.2.20"
Cnn.CommandTimeout = 0
Cnn.Open
Dim strSQL As String
Dim strSQL2 As String
Printer.Orientation = vbPRORPortrait
strSQL = "select * from express where sr_number = '" &
txtSerialNumber.Text & "'"
rst.CursorLocation = adUseClient
rst.LockType = adLockOptimistic
rst.CursorType = adOpenKeyset
rst.Open strSQL, Cnn
'Printer.Width = 16000
'Printer.Height = 7200
'Printer.Print Rst("sr_number");
Printer.CurrentX = 7087
Printer.CurrentY = 1019
Printer.Print rst("send_to");
Printer.CurrentX = 10283
Printer.CurrentY = 1019
Printer.Print rst("send_date");
Printer.CurrentX = 7087
Printer.CurrentY = 1558
Dim Lines() As String
Lines = Split(rst("address"), vbNewLine)
Printer.CurrentX = 7087
'Printer.Print "ProNotes: "
For X = 0 To UBound(Lines)
Printer.CurrentX = 7087
Printer.Print Lines(X)
Next
' Printer.Print Rst("address");
Printer.CurrentX = 7087
Printer.CurrentY = 2493
Printer.Print rst("contact");
'
Printer.CurrentX = 9638
Printer.CurrentY = 2493
Printer.Print rst("tel");
'
If rst("delivery") = 1 Then
Printer.CurrentX = 3287
Printer.CurrentY = 3059
Printer.Print "X"
End If
' If Rst("delivery") = 1 Then
' Printer.CurrentX = 3800
' Printer.CurrentY = 3000
' Printer.Print "x"
' End If
'
If rst("urgent") = 1 Then
Printer.CurrentX = 4988
Printer.CurrentY = 3059
Printer.Print "X"
End If
'
If rst("collection") = 1 Then
Printer.CurrentX = 3287
Printer.CurrentY = 3484
Printer.Print "X"
End If
'
If rst("chop") = 1 Then
Printer.CurrentX = 4988
Printer.CurrentY = 3484
Printer.Print "X"
End If
'
If rst("signafter") = 1 Then
Printer.CurrentX = 3287
Printer.CurrentY = 3909
Printer.Print "X"
End If
'
If rst("dollars") Then
Printer.CurrentX = 4988
Printer.CurrentY = 3909
Printer.Print "X"
End If
Printer.CurrentX = 7426
Printer.CurrentY = 3059
' Dim Lines() As String
Lines = Split(rst("remark"), vbNewLine)
Printer.CurrentX = 7426
'Printer.Print "ProNotes: "
For X = 0 To UBound(Lines)
Printer.CurrentX = 7426
Printer.Print Lines(X)
Next
' Printer.Print Rst("hawb1")
' Printer.Print Rst("invoice1")
' Printer.Print Rst("amount1")
'
' Printer.Print Rst("hawb2")
' Printer.Print Rst("invoice2")
' Printer.Print Rst("amount2")
'
' Printer.Print Rst("hawb3")
' Printer.Print Rst("invoice3")
' Printer.Print Rst("amount3")
'
' Printer.Print Rst("hawb4")
' Printer.Print Rst("invoice4")
' Printer.Print Rst("amount4")
'
' Printer.Print Rst("hawb5")
' Printer.Print Rst("invoice5")
' Printer.Print Rst("amount5")
'
' Printer.Print Rst("hawb6")
' Printer.Print Rst("invoice6")
' Printer.Print Rst("amount6")
'
' Printer.Print Rst("hawb7")
' Printer.Print Rst("invoice7")
' Printer.Print Rst("amount7")
'
' Printer.Print Rst("hawb8")
' Printer.Print Rst("invoice8")
' Printer.Print Rst("amount8")
'
' Printer.Print Rst("hawb9")
' Printer.Print Rst("invoice9")
' Printer.Print Rst("amount9")
'
' Printer.Print Rst("hawb10")
' Printer.Print Rst("invoice10")
' Printer.Print Rst("amount10")
'
Printer.NewPage
Printer.EndDoc
End Sub
Private Sub cmdSearchHawb_Click()
Hawb = txtHawb
frmSearchResult.Show
End Sub
Private Sub cmdSearchSerial_Click()
Serial_Number = txtSerial.Text
frmSearchSerialNumber.Show
' Dim Cnn As New ADODB.Connection
' Dim rst As New ADODB.Recordset
' Cnn.ConnectionString = "Provider=SQLOLEDB.1;Password=sa;Persist
Security Info=True;User ID=sa;Initial Catalog=Express;Data
Source=10.129.2.20"
' Cnn.CommandTimeout = 0
' Cnn.Open
' Dim strSQL
'
' strSQL = "select * from express where sr_number = '" &
txtSerial.Text & "'"
'
' rst.CursorLocation = adUseClient
' rst.LockType = adLockOptimistic
' rst.CursorType = adOpenKeyset
' rst.Open strSQL, Cnn
'
' If rst.RecordCount = 0 Then
' MsgBox "No record Matched"
' Exit Sub
' End If
'
' txtSerialNumber.Text = ""
' txtDate = ""
' txtAddress = ""
' txtContact = ""
' txtTel = ""
' txtRemark = ""
' txtRemark2 = ""
' chkDelivery = 0
' chkUrgent = 0
' chkCollection = 0
' chkChop = 0
' chkSignAfter = 0
' chkCash = 0
'
' txtSerialNumber.Text = rst("sr_number")
' txtDate = rst("send_date")
' txtAddress = rst("address")
' txtContact = rst("contact")
' txtTel = rst("tel")
' txtRemark = rst("remark")
' txtRemark2 = rst("remark2")
' chkDelivery = rst("delivery")
' chkUrgent = rst("urgent")
' chkCollection = rst("collection")
' chkChop = rst("chop")
' chkSignAfter = rst("signafter")
' chkCash = rst("dollars")
'
'
'
'
End Sub
.
- Follow-Ups:
- Re: Strange shift position of Printer.Print
- From: Mike Williams
- Re: Strange shift position of Printer.Print
- From: Mike Williams
- Re: Strange shift position of Printer.Print
- From: Jan Hyde (VB MVP)
- Re: Strange shift position of Printer.Print
- Prev by Date: Re: Displaying critical alarms on a user's screen
- Next by Date: Re: Detail first? Or Big Picture?
- Previous by thread: Looking for code to ping a website to ensure it exists.
- Next by thread: Re: Strange shift position of Printer.Print
- Index(es):
Relevant Pages
|