By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,870 Members | 2,484 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,870 IT Pros & Developers. It's quick & easy.

Looking for way to control scroll bars with VBA

P: 27
I have a main form that has a tab control about 5 tabs with subforms.
When the main form comes up the scroll bar automatically goes down a little so the tabs dont show up they are scrolled up to far. Its annoying, I would like to find some vba possibly on the open form event to lock the vertical scroll bar at the top.

thanks
Feb 7 '10 #1
Share this Question
Share on Google+
2 Replies


missinglinq
Expert 2.5K+
P: 3,532
The problem is being caused by the Tab Order on your main form. Apparently the first control to get focus when the form opens is way down the form.

Place a textbox on your form in the top, left most corner
Goto Properties - Other and rename it DummyTextBox
Now resize it down to just a pinpoint (it won't be visible on the screen)
Now use this code
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.  DummyTextBox.SetFocus
  3. End Sub
If you want to ensure that it does this when moving from record to record, place the code in the Form_Current event instead of the Form_Load event.

Welcome to Bytes!

Linq ;0>
Feb 7 '10 #2

P: 27
Exactly what I was looking for and it worked perfectly.
Feb 10 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.