can someone help me...
this is my problem...
I am generating a report where in i have a textbox with a fix length.. then i want that any datas that will be called out to that textbox will fit into the text box without resizing or editing the textbox...
(hence.. like shrink to fit property of a cell in MS Excel )..
please please please,,,....
thanks in advance...
5 14815
1. Place the report in design view
2. higlight the textbox
3. invoke the property sheet for that textbox
4. set the "can Grow" and "can Shrink" properties to yes
nico5038 3,080
Recognized Expert Specialist
Access has no "shrink to fit property" for a text box.
All you can do is calculate the max length (in general 255 characters) and see or you can set the font size property from 8 to e.g. 6 to have the max text fit the text box e.g. when more than 150 characters are found.
Nic;o)
Thanks nico5038...
Another is that...
I tried to do that by using the TEXTHEIGHT command during the print or preview in the report but an error occurred...
It seam that access don't know this command..
Can show me how to do that??
nico5038 3,080
Recognized Expert Specialist
It's not the "Text height", but the "Font Size" property you need to manipulate in the OnFormat event like: -
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
-
-
If Len(Me.QuerySQL) > 150 Then
-
Me.QuerySQL.FontSize = 6
-
Else
-
Me.QuerySQL.FontSize = 10
-
End If
-
-
End Sub
-
Nic;o)
copy these codes in a report details properties and on print event: - Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
-
Dim ctl As Control, strText As Variant, strName As String
-
' This routine uses the TextWidth methods to determine the maximum size
-
' of font possible to ensure a text string is printed in full in the
-
' report's current font without loosing any characters.
-
-
Me.ScaleMode = 1 ' set all measurments to twips
-
-
For Each ctl In Me.Detail.Controls
-
-
If ctl.ControlType = acTextBox Then
-
-
strName = ctl.Name
-
-
If Nz(ctl.Tag, "") = "" Then
-
ctl.Tag = ctl.FontSize
-
End If
-
-
-
' set the control's fontsize to a suitable large size to begin with
-
ctl.FontSize = ctl.Tag
-
-
' make sure the report font size is equal to the control's fontsize.
-
Me.FontSize = ctl.FontSize
-
-
' grab the text from the control
-
strText = ctl.Value
-
-
' evaluate the Loop until the text fits the Width of the box less 24%. Do this
-
' by reducing the font size incrementally and re-testing the Loop's criteria.
-
If Len(strText) > 0 Then
-
Do Until TextWidth(strText) < ctl.Width '- (ctl.Width * 0.26)
-
ctl.FontSize = ctl.FontSize - 1
-
' reset the report's font size so the TextWidth function will
-
' continue to track the reducing font size correctly.
-
Me.FontSize = ctl.FontSize
-
Loop
-
-
' now evaluate for the height of the text to make sure it fits vertically
-
Do Until TextHeight(strText) < ctl.Height - (ctl.Height * 0.26)
-
ctl.FontSize = ctl.FontSize - 1
-
' reset the report's font size so the TextHeight function will
-
' continue to track the reducing font size correctly.
-
Me.FontSize = ctl.FontSize
-
Loop
-
-
End If
-
End If
-
-
Next ctl
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: R Camarda |
last post by:
Help,
I have a database that has a data file of 2GB and a log file of 31GB.
In enterprise manager, when I choose shrink it says there is 30GB of
unused space. When I shrink the database, it does...
|
by: BashiraInTrouble |
last post by:
Hi Friends,
I have tried almost everything but I cant seem to shrink the
transaction log.
Executing DBCC SQLPERF(LOGSPACE)
gives me this info:
Database Log Size (MB) Log Space Used (%) ...
|
by: Tommy.Vincent |
last post by:
hi all,
This will be a easy question for all out here.
I have a database of 28GB.
having 3 Data Files 22 GB, 3.58 Gb and 2.70 GB respectively.
and a Transaction Log file of 156 mb.
When i...
|
by: Bob Richardson |
last post by:
Is it possible for an image to SHRINK (both height and width, keeping same
h/w ratio) when the browser's width is reduced? It's easy to have both h & w
increase, as needed, to fill up 100% of the...
|
by: Karen |
last post by:
I am trying to make addresses print on a report. I have two fields
for the street address, how do I make the second field not leave an
empty space on the report? I want the city, state, zip to...
| |
by: Gary Bond |
last post by:
Hi All,
Can anybody point me to some 'how-to' documentation, tutorials, etc as to
how to write a shrink/protect wrapper for .Net exes/dlls, (like the
Shrinkwrap product for instance).
I have...
|
by: hallpa1 |
last post by:
Hi all,
I posted messages before about trying to purge many records (about 35%)
of a 200Gig database. The responses gave me a lot to think about,
especially regarding the indexes. But due to the...
|
by: Galka |
last post by:
Hello
Environment: Windows XP, MS Access 2003.
I'd like - in a report - to save space , when there is no company
data.
When there is, I print out company name, address, telephone number and...
|
by: Major Drake |
last post by:
Windows 2003 64 bit sp2 + SQL Server std 32 bit sp2
compability mode 90, recovery model simple.
I have about 40 Gb database where is about 98% free space (I deleted data
from tables).
dbcc...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
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,...
|
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: 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |