Subform takes focus from top of main form (1 Viewer)

rfaircloth

Registered User.
Local time
Yesterday, 19:19
Joined
Jun 26, 2014
Messages
15
I have a form that I created that has a tab control. When the form loads, it automatically sets the focus to a field in the subform. This wouldn't be a problem, except when it does it hides the tabs at the top of the form so I have to go and scroll back up every time I click a tab so that I can see the tabs. Is there a way to adjust this? I have tried hiding a field and setting the focus to it and that didn't work. I also tried setting the focus to the actual tab, but that also did not work. Anyone have any suggestions? Any help would be greatly appreciated!

Thanks,
Ronnie
 

GinaWhipp

AWF VIP
Local time
Yesterday, 19:19
Joined
Jun 21, 2011
Messages
5,899
Is there a field on your Main Form? Why not set the focus to that?
 

rfaircloth

Registered User.
Local time
Yesterday, 19:19
Joined
Jun 26, 2014
Messages
15
No, no other fields in the main form. All it has is the tab controls with subforms.
 

GinaWhipp

AWF VIP
Local time
Yesterday, 19:19
Joined
Jun 21, 2011
Messages
5,899
Hmm, the only time I can think of this happening is when the Subforms are placed to high on the Tab Control... try moving them down.
 

rfaircloth

Registered User.
Local time
Yesterday, 19:19
Joined
Jun 26, 2014
Messages
15
Tried moving it down about an inch or so, but that still didn't work.
 

GinaWhipp

AWF VIP
Local time
Yesterday, 19:19
Joined
Jun 21, 2011
Messages
5,899
Is the Tab Control at the very Top of the Main Form? Try moving it down.
 

vbaInet

AWF VIP
Local time
Today, 00:19
Joined
Jan 22, 2010
Messages
26,374
You can use a little trick to get it to move up.

1. Create a textbox
2. Set the following properties of the textbox:
Code:
Name - txtHidden
Width - 0.002
Height - 0.002
Top - 0
Left - 0
Border Style - Transparent
Locked - Yes
Tab Index - 0
Tab Stop - No
3. Put code in the Open or Load event of your form to move focus to this textbox:
Code:
Me.txtHidden.SetFocus
 

vbaInet

AWF VIP
Local time
Today, 00:19
Joined
Jan 22, 2010
Messages
26,374
Just re-iterating what Gina mentioned in her first post.
 

rfaircloth

Registered User.
Local time
Yesterday, 19:19
Joined
Jun 26, 2014
Messages
15
Yeah, I ended up creating a tiny text box and putting it up in the corner and setting the focus to that and it works now.
 

Users who are viewing this thread

Top Bottom