form questions (1 Viewer)

idxyz

New member
Local time
Today, 09:11
Joined
May 18, 2020
Messages
20
Hi,I have a main form and a subform of datasheet type. When I stretch the main form , prefer that the subform stretch as well. No need to resize the controls on either forms. Secondly, for the subform's horizontal scroll bar to move at the launch, set the focus first on a subform's control and then on an edit box on the main form. The caret or text cursor in the main form's edit box does not show up even though the focus is set on it.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:11
Joined
May 7, 2009
Messages
16,504
1. bring your form (main form) in design view.
click on the subform.
on its property->format:

Horizontal Anchor: Both
Vertical Anchor: Both

2. still in design view, click anywhere on the main form
(possible click inside the Detail section).
then on the ribbon, Form Design->Tab Order,
make sure you arrange the controls so that
the Textbox is the first on the list.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:11
Joined
Feb 19, 2002
Messages
36,453
Use this code in the resize event of the subform control. You will need to experiment with the constants to get the effect you need depending on your resolution.
Code:
Private Sub Form_Resize()
Const LeftRightPadding = (0.125 + 0.25) * 1440
Const TopBottomPadding = (0.25 + 0.375) * 1440

Me.sfrmMemberList.Height = Me.InsideHeight - TopBottomPadding
Me.sfrmMemberList.Width = Me.InsideWidth - LeftRightPadding
End Sub
 

idxyz

New member
Local time
Today, 09:11
Joined
May 18, 2020
Messages
20

arnelgp, tried your suggested items #2, even though does not matter much the focus works but still no caret blinks in the text box. what I do is this, using VBA i set the focus on a subform's edit box to move the subform's horizontal scroll bar to the right then I switch the focus to main form's edit box. Main form's tab order shows its edit box is first on the list.​

Pat Hartman, what does it mean by subform control. There are like numbers of controls on subform. That code goes into resize handler of every one of suborm's controls or just the subform's resize handler?.​

 

June7

AWF VIP
Local time
Today, 08:11
Joined
Mar 9, 2014
Messages
4,413
A subform container is a control that holds a form or report object. The subform container sits on another form or report. The suggested code would resize the subform container. I always name container different from the form or report it holds, such as ctrMemList.
 

Users who are viewing this thread

Top Bottom