Recently, there seems to be several questions specifically related to Printers and changing Printing characteristics for Forms and Reports. For this reason alone, I decided to dedicate this week's Tip to these Topics. The Tip will actually consist of several Tips which I feel are very useful for all Users, from Newbies to Experts. In order to utilize the code contained within these Tips, you must have Access 2002 or later. - How can I generate a List of available Printers?
- 'Prints a list of available Printers and thier Ports
-
'to the Immediate Window
-
Dim prn As Printer
-
-
For Each prn In Application.Printers
-
Debug.Print prn.DeviceName & " on " & prn.Port
-
Next prn
- How can I find the characteristics of the current Window's Default Printer?
- 'Lists specific characteristics of the Current Printer
-
With Application.Printer
-
Debug.Print "Current Printer : " & .DeviceName
-
Debug.Print "Device Driver Name: " & .DriverName
-
Debug.Print "Port Assignment : " & .Port
-
End With
- How do I fill a Combo Box with a list of Installed Printers?
- 'Fills a Combo Box with a list of Installed Printers
-
Dim prn As Printer, cbo As ComboBox
-
Dim strText As String
-
-
Set cbo = Me![cboPrinters]
-
-
'Clear the control's list.
-
cbo.RowSource = vbNullString
-
cbo.RowSourceType = "Value List"
-
-
'Set up three columns
-
cbo.ColumnCount = 3
-
cbo.ColumnWidths = "3in;1in;1in"
-
cbo.Width = 5 * 1440 '5 inches (measured in Twips)
-
-
-
'Bind to the DeviceName column (1)
-
cbo.BoundColumn = 1
-
-
For Each prn In Application.Printers
-
strText = prn.DeviceName & ";" & prn.DriverName & _
-
";" & prn.Port
-
cbo.AddItem strText
-
Next prn
- How do I change the Default Printer?
- 'Changes the Default Printer, then resets it to the original Printer.
-
'This will only work if the report is set up to Print to the Default
-
'Printer
-
-
Set Application.Printer = Application.Printers("Acrobat PDFWriter")
-
DoCmd.OpenReport "<Your Report Name>", acViewNormal, , , acWindowNormal
-
-
'Reset the Default Printer back to the way it was
-
Set Application.Printer = Nothing
- How do I print a Report to a specific device?
- 'The following code will Print rptInvoices to the Acrobat PFDWriter Printer
-
Dim rpt As Report
-
-
DoCmd.OpenReport "rptInvoices", View:=acViewPreview, WindowMode:=acHidden
-
-
Set rpt = Reports("rptInvoices")
-
Set rpt.Printer = Application.Printers("Acrobat PFDWriter")
-
-
DoCmd.OpenReport "rptInvoices"
-
DoCmd.Close acReport, "rptInvoices"
- How can I modify Printer characteristics for a Form or Report?
- 'Open rptInvoices in Design view, change 3 of its Properties
-
'Print the report, and then close the report.
-
-
Const conReport As String = "rptInvoices"
-
-
DoCmd.OpenReport conReport, View:=acViewPreview, WindowMode:=acHidden
-
-
'Force the printer to look to the upper bin for paper, print on
-
'Monarch-size envelopes, and Print two copies, set orientation to
-
'Landscape
-
With Reports(conReport).Printer
-
.PaperBin = acPRBNUpper
-
.PaperSize = acPRPSEnvMonarch
-
.Copies = 2
-
.Orientation = acPRORLandscape
-
.Duplex = acPRDPVertical
-
.PrintQuality = acPRPQMedium
-
End With
-
-
'Now print the report.
-
DoCmd.OpenReport conReport
-
DoCmd.Close acReport, conReport
- How do I change the Layout characteristics for a Form or Report?
- Const conReport As String = "rptInvoices"
-
Const conTwipsPerInch As Long = 1440
-
-
DoCmd.OpenReport conReport, View:=acViewPreview, WindowMode:=acHidden
-
-
'Modify layout information. set up margins, columns, and
-
'print only data.
-
With Reports(conReport).Printer
-
.LeftMargin = 0.5 * conTwipsPerInch
-
.RightMargin = 0.5 * conTwipsPerInch
-
.TopMargin = 1 * conTwipsPerInch
-
.BottomMargin = 1 * conTwipsPerInch
-
.ItemsAcross = 2
-
.ItemLayout = acPRHorizontalColumnLayout
-
.DefaultSize = False
-
.ItemSizeWidth = 3 * conTwipsPerInch
-
.ColumnSpacing = 0.1 * conTwipsPerInch
-
.DataOnly = True
-
End With
-
-
DoCmd.OpenReport conReport
-
DoCmd.Close acReport, conReport
4 16743
I'm Immaculata
Thanks for what you just wrote, i got some help from here. But i'm currently working on a program for a school. My problem is tabularizing the results of my recordsets. i.e. I created a recordset, it got the data from the database and i want to print the output in a tabular form. Please how do i do this?
I'm Immaculata
Thanks for what you just wrote, i got some help from here. But i'm currently working on a program for a school. My problem is tabularizing the results of my recordsets. i.e. I created a recordset, it got the data from the database and i want to print the output in a tabular form. Please how do i do this?
I'm not exactly sure of what you are looking for, but this code will write the First Name, Last Name, and Address Fields of an Employees Table to a Text File (Recordset.txt) in the C:\Test\ Directory. The data will be Tabular and neatly formatted. -
Dim MyDB As DAO.Database, MyRS As DAO.Recordset
-
-
Set MyDB = CurrentDb()
-
Set MyRS = MyDB.OpenRecordset("Select * From Employees", dbOpenSnapshot)
-
-
Open "C:\Test\Recordset.txt" For Output As #1
-
-
Do While Not MyRS.EOF
-
Print #1, MyRS![FirstName]; Tab(20); MyRS![LastName]; Tab(40); MyRS![Address]
-
MyRS.MoveNext
-
Loop
-
-
Close #1
-
-
MyRS.Close
-
Set MyRS = Nothing
OUTPUT: -
Nancy Albericih 507 - 20th Ave. E. Moyamensing Avenue
-
Andrew Fuller 908 W. Capital Waykk
-
Janet Leverling 722 Moss Bay Blvd.
-
Margaret Peacock 4110 Old Redmond Rd.
-
Steven Buchanan 14 Garrett Hill
-
Michael Suyama Coventry House and Miner Rd.
-
Laura Callahan 4726 - 11th Ave. N.E.
-
Anne Dodsworth 7 Houndstooth Rd.
-
Robert King Edgeham Hollow Road
-
Fred Buchanan 14 Garrett Hill
hi
i have a problem when i want to print the following message comes up: can't print or preview the page because the page size you selected is larger than 22.75 inches - any one can help me please
hi
i have a problem when i want to print the following message comes up: can't print or preview the page because the page size you selected is larger than 22.75 inches - any one can help me please
What exactly are you trying to Print?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Daniel Iwan |
last post by:
Hello everyone!
I have a problem with using TCanvas Printer and network printer HP
LaserJet
It print just first page and throws blank all the rest.
WinNT with Borland Builder 5.
All works...
|
by: Geir Baardsen |
last post by:
Hi!
I would like to halt the code while a report I send to printer is printing.
Then when printer has done its job I'll let the code continues.
Anybody that know how this is done in ms...
|
by: tom thorp |
last post by:
I'm currently working on my first complex VB.Net / Winforms application where I'm not using CR to print my Invoices, but have written using PrintDoc
My problem is that on my dev machine,...
|
by: Mika M |
last post by:
Hi all!
I have made an application for printing simple barcode labels using
PrintDocument object, and it's working fine.
Barcode printer that I use is attached to the computer, and this...
|
by: Jean Paul Mertens |
last post by:
Hello,
Is there a way to send a string of text to a generic tekst printer under
..NET.
Somethings as in the good old days
File f = Open("LPT1");
f.Writeline("Blablabla");
The goal is to use...
|
by: Larry L |
last post by:
Hi guys,
been a while since I've been on the group, glad to see some regulars are
still around!
I've got an app that outputs a scale model plan to a printer, printing to a
lettersize or a4...
|
by: dwadish |
last post by:
Hi Guys I am Using VB.Net for creating Windows Applications. and I have project now about a textile shop and need Printing the daily book.
and I have no experience with printing technologies. and i...
|
by: =?Utf-8?B?Sm9jaw==?= |
last post by:
My Brother printer receives two of the same print jobs when I click PRINT -
however, the first job says it is deleting, but it never does and stops
printer printing. This happens on WORD. To print,...
|
by: ahok80 |
last post by:
i want to know code print subreport in vb.net. when i print subreport, why my printer printing main report?
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |