Printing a Simple Report in VB6

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

turnermichAsked:
Who is Participating?
 
Anthony PerkinsCommented:
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
 
Anthony PerkinsCommented:
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
 
turnermichAuthor Commented:
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
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
turnermichAuthor Commented:
I have tried vbformfeed,but,
it just prints a small square on the output page
0
 
trkcorpCommented:
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
 
trkcorpCommented:
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
 
gajendraCommented:
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
 
vim_asteyaCommented:
eagerly waiting for the answer
0
 
Ryan ChongCommented:
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
 
turnermichAuthor Commented:
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
 
turnermichAuthor Commented:
Sorry, i now notice acperkins gave the .NewPage 1st.
0
 
turnermichAuthor Commented:
Thanks for all the helpfull comments, much appreciated

Regards  Turnermich
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.