trouble printing variavel

  • Thread starter Alejandro Carnero
  • Start date
A

Alejandro Carnero

I use this code to print a ticket, i want to print this accumulator stotal

stotal = stotal + rs2.Fields("total")

i have make this line to print this , but only print the word stotal and
not the value of the accumulator
what i m making wrong
Print #1, Chr(10); Tab(0); " & stotal& "

Dim stotal As Double
Dim db As DAO.Database
Dim rs, rs1, rs2, rs3 As DAO.Recordset
nven = 14548
Set db = CurrentDb()
'Set rs = db.OpenRecordset("xcupomvenda")
Set rs1 = db.OpenRecordset("select nvenda,nome from xcupomvenda WHERE
nvenda like '" & nven & "' ")
Set rs2 = db.OpenRecordset("select total,qtd,unit,nvenda,codigo,produto
from tbvenda WHERE nvenda like '" & nven & "' ")
Set rs3 = db.OpenRecordset("select forma from verpago where nvenda like '" &
nven & "' ")

Open "lpt3" For Output As #1 ' imprime na inpressora

Print #1, Chr(18); Tab(6); "Emporio"
Print #1, " -------------------------------"
Print #1, " " & Format(Date, "dd/mm/yyyy") & " " & Format(Time(), "hh:mm") &
""
Print #1, " -------------------------------"
Print #1, Chr(15); Tab(0); rs1.Fields("nome");
Print #1, Chr(15); Tab(20); rs1.Fields("nvenda")
Print #1, " --------------------------------------------------"
Print #1, " Cod. Produto Unit Qtd Total"
Print #1, " --------------------------------------------------"
'############ rotina para imprimir do banco de dados ##################
Do While Not rs2.EOF
Print #1, Chr(15); Tab(0); rs2.Fields("codigo");
Print #1, Chr(15); Tab(8); rs2.Fields("produto");
Print #1, Chr(15); Tab(0); Format(rs2.Fields("unit"), "R$ #,##0.00");
Print #1, ; Tab(10); "X";
Print #1, Chr(15); Tab(18); rs2.Fields("qtd");
Print #1, Chr(15); Tab(28); Format(rs2.Fields("total"), "R$ #,##0.00");
stotal = stotal + rs2.Fields("total")
rs2.MoveNext
Loop

Print #1, Chr(0); Tab(0); " ----------------------------"
'Print #1, Chr(10); Tab(0); " & stotal& "
'Print #1, Chr(10); Tab(0); " & Pagamento "
Print #1, Chr(10); Tab(0); rs3.Fields("forma");
'Print #1, Chr(10) & Chr(13) ' avança uma linha em branco

Close #1
'Fim da Rotina
End Sub

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top