Jumat, 27 Januari 2012

RE: [MS_AccessPros] Width of characters

Stephen Lebans had great solutions for this type of question. http://www.lebans.com/limittextinput.htm
"New Version 2.0 LimitTextInput.zip is a database containing a function to limit the input into a TextBox control. Will allow data input that will fit within the current displayable area of the control only. Handles both Keyboard and Mouse events. Includes a self contained function to mimic the Report objects TextHeight method.
Includes a Report to demonstrate the use of the core fTextHeight function to allow you to gain this functionality in the Format event of the Detail Section. This will allow you to respond to CanGrow events before they happen by moving/sizing your controls in the section's Format event. Example demonstrates how to vertically center the contents of a control within a fixed size box or section."

I believe this is very old which is compounded by the fact that Stephen no longer contributes and is sorely missed :-(
At least someone has escaped the Access addiction.

Duane

To: MS_Access_Professionals@yahoogroups.com
From: john@viescas.com
Date: Fri, 27 Jan 2012 10:52:22 -1000
Subject: RE: [MS_AccessPros] Width of characters


Jane-

I seem to remember there's a Windows API you can call to find the length (in
Twips) of a string in a given font. But I can't seem to find it at the moment.
There is supposedly a TextWidth property for controls on a report, but it
doesn't seem to work.

Anyone else have an idea?

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Lahaina, HI)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Jane
Sent: Friday, January 27, 2012 5:29 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Width of characters

Hi
I have to print a report onto a pre-printed sheet. One of the boxes on the sheet
is 8cm wide. Without using a fixed width font, is there anyway of determining
how wide text will print out on the form - obviously it will depend upon what
the user types & whether they use all uppercase.

After the user has entered text I would like a function to calculate the width
that it would print out (Arial, 9pt) & then let the user know if that's too much
- so they can abbreviate.

Any suggestions?
Many thanks
Jane

------------------------------------

Yahoo! Groups Links


[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MS_Access_Professionals/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/MS_Access_Professionals/join
(Yahoo! ID required)

<*> To change settings via email:
MS_Access_Professionals-digest@yahoogroups.com
MS_Access_Professionals-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
MS_Access_Professionals-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

Tidak ada komentar:

Posting Komentar