Printing a report in Visual Basic from an Array

Posted on 2003-03-04
Medium Priority
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.

Question by:running32
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

Accepted Solution

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


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
         ContPrint = 1000
      End If
   Next N
End Sub

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

Expert Comment

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

Expert Comment

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.


Author Comment

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.


Expert Comment

ID: 8900690
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?
LVL 49

Expert Comment

ID: 9046863
Moderator, my recommended disposition is:

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

DanRollins -- EE database cleanup volunteer

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

771 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