Marshall Brooks
Member
- Local time
- Today, 06:59
- Joined
- Feb 28, 2023
- Messages
- 720
Basically, I have the same question as this thread - https://www.access-programmers.co.uk/forums/threads/auto-size-width-or-label-or-text-box.53796/ - Except in my case, I want the textbox or label to grow vertically and stay fixed width.
I somewhat asked here also: https://www.access-programmers.co.u...-set-userform-combobox-from-sql.328825/page-4 - in Reply #77.
To explain: I have a USERFORM for an InputBox that will dynamically size like this:
i.e, the label width is 228 and the height adjusts to whatever it needs to be. The textbox top is at 50 or ten more than the end of the label and the width is 300 and the entire userform is sized to 50 more than the height of the label and text box.
I am trying to do the same thing with an Access Pop-Up form and I ran into the following:
I tried with .Prompt as a label and with .Prompt as a textbox.
.Prompt.AutoSize is not recognized
.Prompt.SizeToFit seemed promising, but I get an error that it is only available in design view.
.Prompt.CanGrow didn't seem to be recognized, but from the first link, it only works when printing, anyway ...
I somewhat asked here also: https://www.access-programmers.co.u...-set-userform-combobox-from-sql.328825/page-4 - in Reply #77.
To explain: I have a USERFORM for an InputBox that will dynamically size like this:
Code:
With InputBox1
.caption = "Verify Title:"
.Label1.caption = "Please verify database title matches official title." & vbCrLf & vbCrLf & "Click OK when complete."
.Label1.Font.Size = 10
.Label1.AutoSize = False
.Label1.AutoSize = True
.Label1.Width = 228
.ComboBox1.Visible = False
.TextBox1.Visible = True
.TextBox1.top = IIf((.Label1.Height + 10) > 50, .Label1.Height + 10, 50) ' 50 or .Label1.Height+10, whichever is greater.
.TextBox1.value = "Content of TITLE Field" & ""
' Complicated AutoSize Off-On-Off arrangement is required to allow form to autoheight to text box, but not expand if additional rows are added.
.TextBox1.AutoSize = False
.TextBox1.AutoSize = True
.TextBox1.Width = 300
.TextBox1.AutoSize = False
.TextBox1.ScrollBars = fmScrollBarsVertical
.TextBox1.SetFocus
.TextBox1.SelStart = 0
.Height = .Label1.Height + .TextBox1.Height + 50
Dim sngLeft As Single
Dim sngTop As Single
Call ReturnPosition_CenterScreen(.Height, .Width, sngLeft, sngTop)
.left = sngLeft
.top = sngTop
.Show
End With
i.e, the label width is 228 and the height adjusts to whatever it needs to be. The textbox top is at 50 or ten more than the end of the label and the width is 300 and the entire userform is sized to 50 more than the height of the label and text box.
I am trying to do the same thing with an Access Pop-Up form and I ran into the following:
Code:
DoCmd.OpenForm "frmModelessBox"
With Forms![frmModelessBox]
.caption = "Message1"
.Prompt.value = "Line1" & vbCrLf & "Line2" & vbCrLf & "Line3" & vbCrLf & "Line4"
.Prompt.top = 200
.Prompt.SizeToFit
.Prompt.Width = 5000
End With
I tried with .Prompt as a label and with .Prompt as a textbox.
.Prompt.AutoSize is not recognized
.Prompt.SizeToFit seemed promising, but I get an error that it is only available in design view.
.Prompt.CanGrow didn't seem to be recognized, but from the first link, it only works when printing, anyway ...