Solved

Printing a Simple Report in VB6

Posted on 2001-09-12
12
228 Views
Last Modified: 2012-06-27
I need to print a *simple* report from VB6.

Need the distributed program to be small.
Ie. Do not wish to distribute Crystal etc.

I have produced the report using datareport,but, this seems??.. to increase the size of the distributed program a lot!  Needs..MDAC_TYP.EXE (IS THIS CORRECT??) OR Am I Wrong.

-------
If I,Place the report Info formatted in list1.

Dim SEARCH As Integer
    For SEARCH = 0 To List1.ListCount - 1
        Printer.Print List1.List(SEARCH) '
    Next SEARCH
    Printer.EndDoc

I do get a result. but...

1. Can i get a printer dialog, ie windows select printer??
2. Can i put page breaks in.
--------

Appreciate any Expert Comments and Help

0
Comment
Question by:turnermich
[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
  • 5
  • 2
  • 2
  • +3
12 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6478008
Yes, I expect that the Data Report does require MDAC_TYP.EXE.  But then if you are using any database you will also need it.  If you are not I am curious as to how you created your report.

>> 1. Can i get a printer dialog, ie windows select printer?? <<
Check out the Common Dialog control and it's method ShowPrinter.

>> 2. Can i put page breaks in. <<
Printer.NewPage
0
 

Author Comment

by:turnermich
ID: 6478271
I emailed a program to a client, without the MDAC_TYP.EXE
and all ADO to the Access DatAbase etc seemed to work!!, but, The Datareport did not function.

The File is send was 2.9mg, if i included the MDAC_TYP.EXE
it increased to about 10mg.

I am pretty sure this client would not have any VB programs installed by anyone else, but, I am not SURE!

Unable to test on my computer, as i have everything for vb on it.

Would appreciate any advice as to including page breaks., and printer selection, using printer. from a list box.


Regards  Turnermich

0
 

Author Comment

by:turnermich
ID: 6478303
I have tried vbformfeed,but,
it just prints a small square on the output page
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 4

Expert Comment

by:trkcorp
ID: 6478333
Use a common dialog control to select/set a printer...

Read about the printer object in help as the subject is rather broad; but to get a small taste try the following code:
Dim pageno As Byte
For pageno = 1 To 4
   Printer.Print "The value is" & pageno
Next
Printer.EndDoc
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 100 total points
ID: 6478336
I suggest you run the P & D Wizard and create a Setup disk.  This will tell you definitely what you need.

If you are using ADO than MDAC is already installed on the clients workstation.

>> Would appreciate any advice as to including page breaks., and printer selection, using printer. from
a list box. <<
Suggest you take a look at my first comment I answered it there.

Anthony
0
 
LVL 4

Expert Comment

by:trkcorp
ID: 6478342
OH,
Just read the ? again, realized I am not telling you anything you did not already know and acperkins has already told you about printer.newpage.  Sorry...
0
 
LVL 3

Expert Comment

by:gajendra
ID: 6478412
The important properties / methods for effective printing to under windows are ...

Printer.Height
Printer.Width

Printer.CurrentX
Printer.CurrentY

Printer.Print
Printer.Circle
Printer.Line

Printer.NewPage
Printer.EndDoc
Printer.KillDoc

Get the concepts for these straight and you will be amazed at the quality of your reports.

Hope that helps

Gajendra
0
 
LVL 1

Expert Comment

by:vim_asteya
ID: 6478507
eagerly waiting for the answer
0
 
LVL 52

Expert Comment

by:Ryan Chong
ID: 6478901
Hi turnermich,

How about integrate your system with the M$ Word or Excel , or Even Access so that you can print your repost from them?
0
 

Author Comment

by:turnermich
ID: 6479078
I have dug around in the printer.  area, eg  
as per  From: gajendra

Printer.NewPage

and elsewhere

Dim x As Printer
For Each x In Printers
   If x.Orientation = vbPRORPortrait Then
      ' Set printer as system default.
      Set Printer = x
     'MsgBox (P.DeviceName)  
      ' Stop looking for a printer.
      Exit For
   End If
Next

Which i can modify to get a list of available printers.?

-----------------

The above will work , but it seems a bit fragile to me.

Looks very much like i will have to use DataReports to get decent control on the reporting.
0
 

Author Comment

by:turnermich
ID: 6479080
Sorry, i now notice acperkins gave the .NewPage 1st.
0
 

Author Comment

by:turnermich
ID: 6479086
Thanks for all the helpfull comments, much appreciated

Regards  Turnermich
0

Featured Post

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month3 days, 13 hours left to enroll

630 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