?
Solved

Print 5 columns of 20

Posted on 2000-03-07
1
Medium Priority
?
129 Views
Last Modified: 2010-05-02
This project is suppose to print 5 columns of 20 rows.  Could you tell me why it is printing rows of 5?

sample:
1.  323 21. 300 41. 275 61. 289 81. 280
.
.
20. 297 40. 299 60. 293 80. 300 100. 304
___
Dim A(30000) As Long
Dim B As Long
Dim C(100) As Long
Private Sub cmdExit_Click()
End
End Sub

Private Sub Command1_Click()

Cls
Print Tab(20); "Name"; Tab; "Project"; vbCrLf
For x = 1 To 30000
    B = A(x)
    C(B) = C(B) + 1
Next
   
I = 1
For I = 1 To 100
    'print out arrays
    Quiz4.Print Format$(I, "@@@."); C(I); Tab;
    If I Mod 20 = 0 Then Quiz4.Print vbCrLf  'columns
Next

End Sub

Private Sub Form_Load()
Dim I As Integer
'initilizing array
Randomize
For I = 1 To 3000
    A(I) = Int(Rnd * 101)
   
Next
   
End Sub



Private Sub Print_Click()
Quiz4.PrintForm
End Sub
0
Comment
Question by:mad3654
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
Brendt Hess earned 140 total points
ID: 2593579
vbCrLf is an end of line, not an end of column command.  To get the layout you were trying for (as shown in your example), try this code:

For I = 1 To 20
    'print out arrays
    Quiz4.Print Format$(I, "@@@.");
      C(I); Tab; Format$(I+20, "@@@.");
      C(I+20); Tab; Format$(I+40,
      "@@@."); C(I+40); Tab;
      Format$(I+60, "@@@."); C(I+60);
      Tab; Format$(I+80, "@@@.");
      C(I+80)
Next
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question