jimbrooking
10-02-2001, 06:57 AM
I have a form with a text box whose recordsource is a memo-type field. I have a buch of stuff on the form that precludes a significant part of the form being "taken over" by this field. I have sized the field to accommodate probably 90% of the records, but a few of them overflow the field.
A user opening the form on one of these "long" fields will see the text truncated unless s/he moves the focus to the field, e.g., by clicking on it, at which time a vertical scroll bar will appear.
I hate to automatically send the focus to this control every time the form is opened, but I'd like to be able to clue the user that there's more text available if s/he wants to see it.
Does anyone know of a way to determine programmatically if text overflows its allocated text box size? With this, I could make visible a little "more..." indicator near the bottom of the box.
TIA,
Jim
charityg
10-02-2001, 11:06 AM
The way I'm thinking and it may seem sloppy BUT...
If the textbox is a static size, then find out how many characters it will accommodate, then if the len(field)>maxtextvalue, show your more... button.
Make sense?
HTH
Charity
jimbrooking
10-02-2001, 11:12 AM
Charity-
Makes good sense in a fixed-pitch font world. But a given size box will accommodate a lot more "i"s than "w"s when you use a proportional font like Arial. Still hoping for a property of some sort that's obviously NOT well documented!
Thanks anyway!
Jim
[This message has been edited by jimbrooking (edited 10-02-2001).]
Alexandre
10-03-2001, 04:42 PM
Have a look to Stephan Lebans' fantastic site, and particularly in your case: http://www.lebans.com/limittextinput.htm
If you find this of any use...
his great work really deserves a few words of thanks.
Alex
jimbrooking
10-04-2001, 08:07 AM
Alex,
Thank you for this reference. It does not apply here, as the data I'm displaying are pre-defined within memo-type fields in a table, and not subject to modification by users.
The data/memos are actually summaries of different requirements of the US regulations on privacy of medical records, and must be available for display in their entirety. What I was looking for was some way to provide a visual cue to the user that indicates the need to scroll the field to see the remainder of the field. Absent that, I have set the focus (DoCmd.GoToControl) to this field in the OnCurrent and OnOpen events. This activates a vertical scroll bar, thus providing my visual cue. However, placing the focus there makes the user click elsewhere to do what the form asks, namely indicate the user's degree of compliance with the requirement.
Thanks again,
Jim
Alexandre
10-04-2001, 11:55 AM
jimbrooking
do a bit of searching on that same site
You will find another sample of code automatically adapting text font size to accomodate a fixed size control.
If your text do not exceed too much the side of your control it might be a solution?
Or...
would it be a solution to tag your memo control at the same time that you put the focus onto it (on current), in order to be able to detect, toggle off the tag, and by pass the on clik event when the user just comes have triggered the on current event?
Alex
[This message has been edited by Alexandre (edited 10-04-2001).]