Hi people need codes for displaying serial number in a receipt (ie a unique number after every transaction) here is the receipt code am working on

Private Sub CmdPrint_Click()
'printing a receipt
If MsgBox("Print Receipt?", vbYesNo, "Receipt") = vbYes Then
Printer.Print Tab(30);
Printer.Print Tab(30); "TIKMASH MANAGEMENT LIMITED"
Printer.Print Tab(30); "SERVICE CHARGE PAYMENT"
Printer.Print Tab(30); "KATAMU COURT, PLAINSVIEW, SOUTH B."
Printer.Print Tab(30); "L.R NO. 93/1272."
Printer.Print Tab(30); "TEL: +254 721800003"
Printer.Print
Printer.Print Tab(15); "---------------------------------------------------------------------------------------------------------"
Printer.Print Tab(40); "SERVICE CHARGE RECEIPT"
Printer.Print Tab(15); "---------------------------------------------------------------------------------------------------------"
Printer.Print
Printer.Print Tab(15); "Name:"; Spc(3); FrmTikmash.TxtName.Text
Printer.Print
Printer.Print Tab(15); "Unit NO.:"; Spc(3); FrmTikmash.TxtUnitNo.Text
Printer.Print
Printer.Print Tab(15); "Month:"; Spc(3); FrmTikmash.LblDate2.Caption
Printer.Print
Printer.Print Tab(15); "Amount Paid:"; Spc(3); FrmTikmash.TxtAmount.Text
Printer.Print
Printer.Print Tab(15); "Balance B/F:"; Spc(3); FrmTikmash.TxtBal.Text
Printer.Print
Printer.Print Tab(15); "Total Paid:"; Spc(3); FrmTikmash.TxtTotal.Text
Printer.Print
Printer.Print
Printer.Print
Printer.Print
Printer.Print
Printer.Print
Printer.Print
Printer.Print Tab(15); "Service Charge:"; Spc(3); FrmTikmash.TxtPay.Text
Printer.Print
Printer.Print Tab(15); "Balance B/F:"; Spc(1); ".........................................."
Printer.Print
Printer.Print Tab(15); "Agent's Signature:"; Spc(1); "..........................................."
Printer.Print
Printer.EndDoc
End If
End Sub

What serial number? How is it formatted? How does the subroutine get it?

hi Masterace,

Based on your 2 threads, i understand that solution to your problem could be something like this-

1. create a file to store your last receipt number i.e. "2001" (its last 4 numbers of receipt number u gave TK012001)
2. Every time u want to print a receipt -
a) fetch this number from your file
b) increment this
c) append it with "TK01"
d) restore the incremented number to your file

hope this is what you were looking for...

Pankaj

hi Masterace,

Based on your 2 threads, i understand that solution to your problem could be something like this-

1. create a file to store your last receipt number i.e. "2001" (its last 4 numbers of receipt number u gave TK012001)
2. Every time u want to print a receipt -
a) fetch this number from your file
b) increment this
c) append it with "TK01"
d) restore the incremented number to your file

hope this is what you were looking for...

Pankaj

Hi pankaj

am able to see the code in the receipt but its not updatin wil u please help do not know where to code sorr am a newbie

thanx

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.