Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing a Simple Report in VB6

Posted on 2001-09-12
12
Medium Priority
?
230 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
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.

 
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 300 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 53

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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

688 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