Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a textbox show all text when clicked

Status
Not open for further replies.

PaultheS

Programmer
May 12, 2005
92
CA
I have some text boxes on a form that contain more text than they automatically show. I'd like it to stay like that unless the user clicks in the text box, in which case the text box would pop up larger. Think of how a cell in Excel shows only a bit of text, but then shows the entire box once that cell is selected.

Is there a way to do this with an Access textbox?
 
Hi
Here is a rough outline of an idea:
Code:
Dim x, y

Private Sub txtMyText_GotFocus()
y = Me.txtMyText.Height
x = Me.txtMyText.Width
Me.txtMyText.Height = y * 2
Me.txtMyText.Width = x * 2
End Sub

Private Sub txtMyText_LostFocus()
Me.txtMyText.Height = y
Me.txtMyText.Width = x
End Sub
 
You can change the Height and Width values for the textbox in Got_Focus & Lost_Focus events.

Example:

Private Sub txtEnlarge_GotFocus()
txtEnlarge.Height = 1500
txtEnlarge.Width = 5500
End Sub

Private Sub txtEnlarge_LostFocus()
txtEnlarge.Height = 240
txtEnlarge.Width = 1440
End Sub

Regards,
gkprogrammer
 
How are ya PaultheS . . . .

In the [blue]Click[/blue] or [blue]DoubleClick[/blue] event of the textbox, see if this works (you can edit and update as well):
Code:
[blue]   DoCmd.RunCommand [purple]acCmdZoomBox[/purple][/blue]

Calvin.gif
See Ya! . . . . . .
 
AceMan1,

Another arrow to put in my quiver! It works a treat! Thank you! Don't need it now, but you never know! It's a shame there's not a single source with all these things in it; don't even think about saying MSDN! LOL! Maybe you should write a book!

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
Howdy missinglinq . . . . .
[blue]It's a shame there's not a single source with all these things in it . . .[/blue]
It does exist . . . ist called your own [blue]Extremely Well Indexed Library[/blue]. ;-)

Calvin.gif
See Ya! . . . . . .
 
He - he - for the zooming, I find it efficient to teach the users to hit Shift+F2 ;-)

Roy-Vidar
 
Thanks AceMan, it does indeed work well...

One additional question, is there a way to add code to every textbox on a form without doing them all one at a time? Like, so that if any box is double clicked then load a zoombox?
 
Roger That PaultheS . . . . .

Did you try [blue]Roy Vidar's[/blue] suggestion?

Same [blue]ZoomBox[/blue] from the keyboard!

In the [blue]ControlTip Text[/blue] property of the Textboxes of interest, just enter:

[purple]Hit Shift + F2 for Zoom![/purple]

Excellent for typists!

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top