form questions (1 Viewer)

idxyz

New member
Local time
Yesterday, 17:12
Joined
May 18, 2020
Messages
24
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
Today, 08:12
Joined
May 7, 2009
Messages
19,228
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
Yesterday, 20:12
Joined
Feb 19, 2002
Messages
43,213
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
Yesterday, 17:12
Joined
May 18, 2020
Messages
24

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
Yesterday, 16:12
Joined
Mar 9, 2014
Messages
5,463
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