I have code, below, on a single form that resizes a control if the text is longer than the control width, when the control has focus.
Is it possible to do the same thing on a continuous form?
All I can do so far is highlight the entire column.
Is it possible to do the same thing on a continuous form?
All I can do so far is highlight the entire column.
Code:
Public Sub newSize(str As String)
Dim cTop As Integer
Dim Ctrl As Control
Dim frm As Form
Set frm = Screen.ActiveForm
Set Ctrl = frm.ActiveControl
nLen = getInt(Len(Nz(Ctrl, "")))
If str = "UP" And nLen > 1 Then
cHeight = Ctrl.Height
cTop = [Ctrl].Top - (cHeight * IIf(nLen > 1, nLen - 1, 1))
[Ctrl].Top = cTop
[Ctrl].Height = cHeight * nLen
ElseIf str = "DN" And Ctrl.Height > 350 Then
Ctrl.Top = [Ctrl].Top + (cHeight * IIf(nLen > 1, nLen - 1, 1))
Ctrl.Height = cHeight
End If
Set frm = Nothing
Set Ctrl = Nothing
End Sub
Public Function getInt(n As Double)
If n > 0 Then
n = n / 50
n = IIf(n > Int(n), Int(n + 1), Int(n))
Else
n = 1
End If
getInt = n
End Function
Last edited: