If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Q For Stephen Lebans TextWidthHeight
Hi Stephen,
Thank you for writing this fantastic method! I would like to use your textwidthheight module, but I need a little help. I downloaded the zip. 1. In your form "customer", I see the buttons to turn autosizing on/off, and I see the text and width calculation textboxes. I assume neither are required for the module to work, correct? I have pasted the module into a module of the same name in my db. I also added the subs to my form, but I only pasted the parts that I assume I need if I don't need the above functions. Here is what I now have in my form: Option Compare Database Option Explicit ' Copyright Lebans Holdings 1999 Ltd. ' Stephen @lebans.com ' Flag for Autosizing Private blAuto As Boolean ' Initial Height of Memo control Private lngInitMemoHeight As Long ' Initial Widths of controls Private lngInitComment As Long Private Sub Form_Current() ' Let's call our function to determine the ' Width or Height for the contents of each control. ' The function uses the Control's Font settings ' to determine the Width/Height of the ' contents of the control. You can ' optionally pass a string directly to the function ' but you must always include a control setup ' with the font settings you want applied to ' the text. ' You may also optionally pass by reference two ' long variables that the function will return the ' string width and height. If blAuto Then ' Enable autosizing of each control Dim lngTopMargin As Long Dim sngMargin As Single ' Margins of TextBox. ' Percentage of StringWidth for let and right margins. sngMargin = 0.02 ' Fixed Top Margin of TextBox lngTopMargin = 60 ' Exit if we are on a new record If Me.NewRecord Then ' Restore control's original height Me.Comment.Height = lngInitMemoHeight Exit Sub End If With Me.Comment .Height = lngHeight + lngTopMargin End With End If End Sub Private Sub Form_Load() ' Save the control's original dimensions lngInitMemoHeight = Me.Comment.Height ' Turn Autosizing On blAuto = True Call Form_Current End Sub I get an error that highlights ".Height" ands says "Method or Data Member Not Found". I get this error on compile, and also If I run it. What should I do? Thank you! |
#2
|
|||
|
|||
Q For Stephen Lebans TextWidthHeight
My sample form contains a TextBox control named "Comment". What have you
named the TextBox control on your form you are attempting to autosize? -- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "justme" wrote in message ... Hi Stephen, Thank you for writing this fantastic method! I would like to use your textwidthheight module, but I need a little help. I downloaded the zip. 1. In your form "customer", I see the buttons to turn autosizing on/off, and I see the text and width calculation textboxes. I assume neither are required for the module to work, correct? I have pasted the module into a module of the same name in my db. I also added the subs to my form, but I only pasted the parts that I assume I need if I don't need the above functions. Here is what I now have in my form: Option Compare Database Option Explicit ' Copyright Lebans Holdings 1999 Ltd. ' Stephen @lebans.com ' Flag for Autosizing Private blAuto As Boolean ' Initial Height of Memo control Private lngInitMemoHeight As Long ' Initial Widths of controls Private lngInitComment As Long Private Sub Form_Current() ' Let's call our function to determine the ' Width or Height for the contents of each control. ' The function uses the Control's Font settings ' to determine the Width/Height of the ' contents of the control. You can ' optionally pass a string directly to the function ' but you must always include a control setup ' with the font settings you want applied to ' the text. ' You may also optionally pass by reference two ' long variables that the function will return the ' string width and height. If blAuto Then ' Enable autosizing of each control Dim lngTopMargin As Long Dim sngMargin As Single ' Margins of TextBox. ' Percentage of StringWidth for let and right margins. sngMargin = 0.02 ' Fixed Top Margin of TextBox lngTopMargin = 60 ' Exit if we are on a new record If Me.NewRecord Then ' Restore control's original height Me.Comment.Height = lngInitMemoHeight Exit Sub End If With Me.Comment .Height = lngHeight + lngTopMargin End With End If End Sub Private Sub Form_Load() ' Save the control's original dimensions lngInitMemoHeight = Me.Comment.Height ' Turn Autosizing On blAuto = True Call Form_Current End Sub I get an error that highlights ".Height" ands says "Method or Data Member Not Found". I get this error on compile, and also If I run it. What should I do? Thank you! |
#3
|
|||
|
|||
Q For Stephen Lebans TextWidthHeight
Hi Stephen!
My textbox is called "Comment", also. |
#4
|
|||
|
|||
Q For Stephen Lebans TextWidthHeight
But, your textbox is named TestMemo, not comment, right?.
|
#5
|
|||
|
|||
Q For Stephen Lebans TextWidthHeight
I only glanced at it and did not realize that you had modifed the code.
Is there any chance the field bound to this TextBox control has the same name as the control? Change the control's name if it does. Otherwise, the compiler is complaining that your control named "Comment" does not expose a Height property. -- HTH Stephen Lebans http://www.lebans.com Access Code, Tips and Tricks Please respond only to the newsgroups so everyone can benefit. "justme" wrote in message ... But, your textbox is named TestMemo, not comment, right?. |
#6
|
|||
|
|||
Q For Stephen Lebans TextWidthHeight
the control was NOT the same as the field, so I made them both the same and
now it works! The only thing is, I am using it in a continuous form, and it does not seem to autosize for each record, it autosizes all the records to the biggest one. Is there any way to avoid this? Just wondering. Thanks!! |
#7
|
|||
|
|||
Q For Stephen Lebans TextWidthHeight
In a continuous form, you do not have the ability to address a single
instance of a given control. It's an all-or-nothing proposition. -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "justme" wrote in message ... the control was NOT the same as the field, so I made them both the same and now it works! The only thing is, I am using it in a continuous form, and it does not seem to autosize for each record, it autosizes all the records to the biggest one. Is there any way to avoid this? Just wondering. Thanks!! |
Thread Tools | |
Display Modes | |
|
|