Subform takes focus from top of main form

rfaircloth

Registered User.
Local time
Today, 08:46
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
 
Is there a field on your Main Form? Why not set the focus to that?
 
No, no other fields in the main form. All it has is the tab controls with subforms.
 
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.
 
Tried moving it down about an inch or so, but that still didn't work.
 
Is the Tab Control at the very Top of the Main Form? Try moving it down.
 
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
 
Just re-iterating what Gina mentioned in her first post.
 
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

Back
Top Bottom