473,395 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Report stretching/reducing

Hello to all.

Ever had a problem when your print some reports in a printer other the
one you use more frequently, in which the report width span more tban
one page? I did, and didn't liked it.

But there's a simple way for automatically reducing the report size to
a size that prints well in the troubling printer. Here goes a sub that
receives the following parameters:

- repName : Report name;
- xFactor : Factor to be multiplied by the 'Left' and 'Width'
properties;
- yFactor : Factor to be multiplied by the 'Top' and 'Height'
properties;

So, 'StretchReport "Report1", 1.1, 0.95' stretches the height of
"Report1" by 10% and reduces it's width by 5%.

I hope that it will be useful to anyone. Please feel free to comment
the code and this article.
-- The Code -------------------------------------------------------------------

Option Compare Database
Option Explicit

Sub Demo()
Const kRepName = "EV - Registo de Visitas"
Const kXFact = -2.7
On Error Resume Next
DoCmd.Close acReport, kRepName, acSaveNo
On Error GoTo 0

StretchReport kRepName, kXFact

DoCmd.OpenReport kRepName, acViewPreview
End Sub
' Aplica um determinado factor ao tamanho e posição de todos os
controlos de um relatório.
' Argumentos:
' - 'repName': Nome do relatório;
' - 'xFactor': Factor a multiplicar pelas propriedades '.Left' e
'.Width' dos controlos;
' - 'yFactor': Factor a multiplicar pelas propriedades '.Top' e
'.Height' dos controlos;
' 'xFactor' e 'yFactor' devem ser a percentagem a esticar (se forem
positivos) ou a contraír
' (se forem negativos).
' Por exemplo, 'StretchReport "rep", 10, -5' estica a largura do
relatório 'rep' em 10% e
' contrai a sua altura em 5%.
' NOTA: O relatório é deixado aberto, com as alterações feitas por
guardar.
Sub StretchReport(repName As String, ByVal xFactor As Single, Optional
ByVal yFactor As Single = 0)
DoCmd.OpenReport repName, acViewDesign
Dim rep As Report
Set rep = Reports(repName)
Dim xf As Double
xf = 1 + xFactor / 100
Dim yf As Double
yf = 1 + yFactor / 100

Dim ctrl As Control
For Each ctrl In rep.Controls
ctrl.Left = Round(ctrl.Left * xf)
ctrl.Width = Round(ctrl.Width * xf)
ctrl.Top = Round(ctrl.Top * yf)
ctrl.Height = Round(ctrl.Height * yf)
Next
rep.Width = 0 ' Obrigar a assumir a largura mínima do relatório.
End Sub
Nov 13 '05 #1
0 1333

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Martin | last post by:
Hi, I have an Access 97 report that mimics an official UK Covernment Customs document, with Page Headers and Footers presenting static data for each page (logos etc). The report is made up...
0
by: Alfred Wallace | last post by:
Hello, I'm using CRAXDRT and AxCRVIEWER9Lib.AxCRViewer9 in a c# form to see a cystal report. I'm connected to oracle 9. database and my report is connected on several tables and show several...
4
by: Arthur Dent | last post by:
Hello all... i have a really frsutrating problem here... This is only happening in IE (6 & 7b2), Mozilla and Netscape are both OK. I have a top-level table with a width of 760px, so it should be...
11
by: Ryan | last post by:
I am writing a VB (2005) program that will allow the user to fill out and print a form. The form input is stored in a database (SQL 2005) to be retrieved/viewed/printed later. The form is...
1
by: derekdeben | last post by:
Hi, I created a report that groups on week ending dates and has a total for each date and a grand total for the month. However, The report is 13 pages long with many blank pages since I said...
2
by: Matt800 | last post by:
Two little problems that are annoying me!; 1) I have created a report in access (based on a parameter query) which contains 18 fields (mainly dates - dd/mm/yyyy). There are too many fields to fit...
1
by: replyrpatil | last post by:
What I am trying to do: I need to print a compact access report (font 6 size) created using RTF2 program developed by Stephen Lebans to generate a TIF image of custom size (5.5 in x 2.0 in) ...
0
by: shaiful | last post by:
Hi All, I have a problem with to show the data report. The massage is " Report width is larger than the paper width" However, i know it can be solve by reducing report width, but i want to make...
2
by: NJonge01 | last post by:
Hi, I have a report that should conditionally show some objects on the Report Header. These are the lowest objects in that section and they're not always necessary depending on where I'm opening...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
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...
1
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...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.