I am developing a sample project in Visual basic 6 and MS Access 2003.

  1. I wish to print Invoice in Continuous statonery (Roll Paper ) width of paper 5.5 inches
    I am using printer.print Code using (x,y) co-ordinates

My problem , after printing one bill printer skips and giving lot of space between two bills. My aim printer must stop printing after completing one bill. ( no gaps required ) and user tear off that bill and continue to print next bill.

I am printing invoice in DOT MATRIX PRINTER (USB )

My code is

Dim cy As Long
Dim cx As Long
Dim cx1 As Long
Dim tmpval As Double

Set rs = New ADODB.Recordset
sql = "select * from del_head where tran=" & Trim(txtcustno.Text) & ""
rs.Open sql, CN, adOpenStatic, adLockPessimistic
If rs.RecordCount > 0 Then

cno = rs(2)
custname = rs(3)
ctown = rs(8)

Set rs3 = New ADODB.Recordset
rs3.Open "select sum(amountdue)-sum(amountrec) from receipt_d where cid = " & cno & "", CN, adOpenStatic, adLockPessimistic
custdue = rs3(0)
rs3.Close

Printer.Font = "Arial"
Printer.FontBold = True
Printer.FontSize = 12
Printer.CurrentX = 3400
Printer.CurrentY = 50
Printer.Print " XXXXXXXXXXXXXXXX "
Printer.Font = "Arial"
Printer.FontBold = False
Printer.FontSize = 10
Printer.CurrentX = 3400
Printer.CurrentY = 350
Printer.Print " XXXXXXXXXXXXXXXXXXXXX "
Printer.Font = "Arial"
Printer.FontBold = False
Printer.FontSize = 11
Printer.CurrentX = 2600
Printer.CurrentY = 650
Printer.Print " XXXXXXXXXXXXXXXXXXXX "
Printer.Font = "Arial"
Printer.FontBold = False
Printer.FontSize = 11
Printer.CurrentX = 3300
Printer.CurrentY = 950
Printer.Print " XXXXXXXXXXXXXXXXXXXX "

Printer.Font = "DCI + Tml + Ismail"
Printer.CurrentX = 100
Printer.CurrentY = 1550

Printer.Line (1000, 1800)-(7800, 1800) '-h line

cy = 2000
cx = 6500
Set rs1 = New ADODB.Recordset
sql = "select * from del_det where transno=" & Trim(txtcustno.Text) & ""
rs1.Open sql, CN, adOpenStatic, adLockPessimistic
Do While Not rs1.EOF

Printer.Font = "DCI + Tml + Ismail"
Printer.CurrentX = 1100
Printer.CurrentY = cy
Printer.Print rs1(3)

Printer.Font = "Arial"
Printer.FontSize = 10

Printer.CurrentX = 3500
Printer.CurrentY = cy
Printer.FontSize = 9
Printer.Print rs1(4)

Printer.CurrentX = 4700 - TextWidth(rs1(5))
Printer.CurrentY = cy
Printer.Print Format(rs1(5), "00.00")

Printer.CurrentX = cx - TextWidth(rs1(6))
Printer.CurrentY = cy
Printer.Print Format(rs1(6), "00.00")

'Format$(123,"@@@@@@")

rs1.MoveNext
cy = cy + 250
Loop
Printer.Line (6000, cy)-(7800, cy) '-h line

Printer.Font = "DCI + Tml + Ismail"
Printer.CurrentX = 4500
Printer.CurrentY = cy + 100
Printer.FontSize = 10
Printer.Print " bkhj;jk; "

Printer.Line (6000, cy)-(7800, cy) '-h line
Printer.EndDoc
End If

Do NOT use VB6. It's dead, no longer supported, nobody uses it except idiot schoolkids who think using a 20 year old product is "kewl".
Use something that actually has market value, something like C#.

As to your excuse for some code, I'd not be surprised at all if "enddoc" executes a page break.

commented: If you don't have anything positive to post then DO NOT post! No need to call any person an idiot! -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.