Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FOR NEXT - NESTING - FORMATING

Status
Not open for further replies.

compcad

Programmer
Mar 22, 2002
52
0
0
US
I got the watermark to work fine on the code except know that I have the watermark in the code the ticket numbering system in the code will not work correctly. I want each ticket to be as shown below:

page1: 0001, 0006, 0011, 0016
page2: 0002, 0007, 0012, 0017
page3: 0003, 0008, 0013, 0018
page4: 0004, 0009, 0014, 0019
page5: 0005, 0010, 0015, 0020

The code I am using is a FOR NEXT LOOP nested.

Private Sub Command1_Click()
Dim X As Integer
Dim nIndex As Integer
For X = 1 To 5
For nIndex = X To 20 Step 5
Printer.Print Format$(nIndex, "0000")
Next nIndex
Next X
Printer.NewPage
Printer.EndDoc
End Sub

I do not know how to integrate this code with the code below to get them to work together.

Private Sub Command1_Click()
Dim a As Integer
Dim nIndex As Integer
Dim x As Integer
Dim tickets As Integer
Dim y As Integer
Dim pages As Integer

tickets = 20
pages = 5

For x = 1 To pages
For A = 200 To 12180 Step 3800

Printer.PaintPicture picAddress, 7300, a, 4000, 2500
Printer.PaintPicture picDemo, 200, a, 6000, 3500

Printer.Font.Size = 11
Printer.Print ""
Printer.Font.Name = "arial"
Printer.Font.Size = 17
Printer.Print Tab(11); "CASCADE BLOOD SERVICES"
Printer.Font.Size = 5
Printer.Print ""
Printer.Font.Size = 10
Printer.Print Tab(35); "presents"
Printer.Font.Size = 10
Printer.Print ""
Printer.Font.Size = 13
Printer.Print Tab(22); "Annual Fall Raffle"
Printer.Font.Size = 8
Printer.Print Tab(4); "This is a description of the raffle and its funding purposes. It tells what we're going to"
Printer.Print Tab(4); "do with the money."
Printer.Font.Size = 10
Printer.Print ""
Printer.Font.Size = 12
Printer.Print Tab(23); "1st Prize:"; Tab(34); "Red Mercedes Convertible"
Printer.Font.Size = 10
Printer.Print ""
Printer.Font.Size = 12
Printer.Print Tab(23); "Value:"; Tab(34); "$64,000.00"
Printer.Font.Size = 10
Printer.Print ""
Printer.Font.Size = 12
Printer.Print Tab(23); "Drawing:"; Tab(34); "11/29/2002"
Printer.Font.Size = 8
Printer.Print ""
Printer.Font.Size = 10
Printer.Print Tab(3); "$10.00"; Tab(28); txtText5; Tab(65); Format$(nIndex, "0000") & " of " & Format$(tickets, "0000"); Tab(85); "$10.00"; Tab(120); Format$(nIndex, "0000")
Next A
Next x

y = Printer.CurrentY
Printer.Line (7222, 15500)-(7222, 25)
Printer.Line (7223, 15500)-(7223, 25)
Printer.CurrentY = y

Printer.NewPage
End
End
End Sub

the watermarks are now fine I just need to get the ticket numbers to print correctly.

If you could help I need the answer soon if you can help
THANK YOU
Stephen Mentzer
COMPCAD@AOL.COM
 
It looks to me like your trying to print 4 tickets(or 4 somethings) per page. I wouldn't try another loop. Maybe just increment 1 variable inside the loop, like this

Private Sub Command1_Click()
Dim a As Integer
Dim nIndex As Integer
Dim x As Integer
Dim tickets As Integer
Dim y As Integer
Dim pages As Integer

tickets = 20
pages = 5

For x = 1 To pages
A = 200

For nIndex = X To 20 Step 5

Printer.PaintPicture picAddress, 7300, a, 4000, 2500
Printer.PaintPicture picDemo, 200, a, 6000, 3500

Printer.Print Format$(nIndex, "0000")

Printer.Font.Size = 11
Printer.Print ""
Printer.Font.Name = "arial"
Printer.Font.Size = 17
Printer.Print Tab(11); "CASCADE BLOOD SERVICES"
Printer.Font.Size = 5
Printer.Print ""
Printer.Font.Size = 10
Printer.Print Tab(35); "presents"
Printer.Font.Size = 10
Printer.Print ""
Printer.Font.Size = 13
Printer.Print Tab(22); "Annual Fall Raffle"
Printer.Font.Size = 8
Printer.Print Tab(4); "This is a description of the raffle and its funding purposes. It tells what we're going to"
Printer.Print Tab(4); "do with the money."
Printer.Font.Size = 10
Printer.Print ""
Printer.Font.Size = 12
Printer.Print Tab(23); "1st Prize:"; Tab(34); "Red Mercedes Convertible"
Printer.Font.Size = 10
Printer.Print ""
Printer.Font.Size = 12
Printer.Print Tab(23); "Value:"; Tab(34); "$64,000.00"
Printer.Font.Size = 10
Printer.Print ""
Printer.Font.Size = 12
Printer.Print Tab(23); "Drawing:"; Tab(34); "11/29/2002"
Printer.Font.Size = 8
Printer.Print ""
Printer.Font.Size = 10
Printer.Print Tab(3); "$10.00"; Tab(28); txtText5; Tab(65); Format$(nIndex, "0000") & " of " & Format$(tickets, "0000"); Tab(85); "$10.00"; Tab(120); Format$(nIndex, "0000")
A=A+3800
Next nIndex
Next x

y = Printer.CurrentY
Printer.Line (7222, 15500)-(7222, 25)
Printer.Line (7223, 15500)-(7223, 25)
Printer.CurrentY = y

Printer.NewPage
End
End
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top