Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Printing a report in Visual Basic from an Array

Posted on 2003-03-04
6
Medium Priority
?
189 Views
Last Modified: 2013-11-25
I have a vb  program that reads a sql database for errors.  When it finds an error it writes to an array. (this works).   I want to write these errors out to a report but the only problem is that the number of errors is larger than one form page so they scroll off the page and I cannot see the other errors.  I need another solution to generate an error report to display to the user.  Can anyone help.

Thanks
0
Comment
Question by:running32
6 Comments
 
LVL 2

Accepted Solution

by:
JoaTex earned 200 total points
ID: 8068489
Hi
Try this litlle code and a correct it to your application:

Code:

Option Explicit
Dim MyArray(100)
Dim ContPrint
Dim N

Private Sub CommandPrint_Click()
   ContPrint = 1000
   For N = 0 To 100
      Printer.CurrentX = 1000
      Printer.CurrentY = ContPrint
      Printer.Print MyArray(N)
      ContPrint = ContPrint + 240
      If ContPrint >= 15000 Then
         Printer.NewPage
         ContPrint = 1000
      End If
   Next N
   Printer.EndDoc
End Sub

Private Sub Form_Load()
For N = 0 To 100
   MyArray(N) = N
Next N
End Sub
0
 
LVL 3

Expert Comment

by:DocM
ID: 8068513
Use a TextBox with the MultiLine property set to True
and the ScrollBars property set to 2.
0
 

Expert Comment

by:MRAMetharam
ID: 8069794
I agree with DocM. If you are only going to show this to the user why complicate your life :)

KISS
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:running32
ID: 8073027
JoaTex, What is I wanted to display it on a new screen as well as print it?

I am using a list box but it scrolls off the page.

Thanks
0
 

Expert Comment

by:CleanupPing
ID: 8900690
running32:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9046863
Moderator, my recommended disposition is:

    Accept JoaTex's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

564 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