Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Printing a Simple Report in VB6

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

 
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 54

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

916 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