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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shrinking and expanding comment line in form

Status
Not open for further replies.

101287

MIS
Apr 8, 2006
189
US
I would like to know if someone could direct me to articles and/or code samples in vba to add functionality in access to enable a form comment line to be expanding or shrinking. For example, the user can click on icon and expand the comment line then click it back to shrink the form.

I have office 2007 with ms access 2007. Your guidance will be appreciated.

Luis
 

There are a few ways to do this. One is to use the GotFocus/LostFocus events to change the width (and height and position, too if you want) of the field.
Code:
Sub MyField_GotFocus
With Me.MyField
   .Width = [i]newwidth[/i]
   .Height = [i]newheight[/i]
   .Left = [i]newleftposition[/i]
End With
End Sub

Sub MyField_LostFocus
With Me.MyField
   .Width = [i]originalwidth[/i]
   .Height = [i]originalheight[/i]
   .Left = [i]originalleftposition[/i]
End With
End Sub
Another method (which I just used in a form for a project I am working on) is to create a form that has nothing but a TextBox, a Cancel Button and a Save Button. The TextBox has Vertical ScrollBars Enabled so that the user can type as much as they want. The Form is set to Modal and Popup and is positioned to appear where I want it over the form. When I open the form on the OnClick Event of the origninal form TextBox, I copy its contents to the popup form Text Box. When I close the popup with 'Save' it copies the contents back... the 'Cancel' button just closes the popup. This method looks cleaner than expanding the original TextBox as much as I needed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top