Ms Access Form brings me to the middle of the subform

For some reason I am having I think a focus issue on a form that contains a tab property and multiple pages (5).  One of the  pages (page2) is quite long vertically.  When I click on this page (page2) from another page I am brought to the middle of the form and no field appears has focus.  I do not understand this as my tab order is fine.  The tab order for this particular page has the subform found in the upper left hand part of the subform as the first subform for the tab order.  

I even tried to put a text box within the tab property and within the OnClick property I have the focus be set to this text box.  However, I still have the same issue:  whenever I click on page2 I am brought midway down on page2.  I want to be at the top of page2 anytime I select page2.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael CarrilloInformation Systems ManagerCommented:
There are a couple of possibilities.
You might have a field or object behind a field or object.  
You might have a higher tab order to an object; like a wire frame.

What I have done in the past is to isolate the object that is causing the problem.
Make a backup of the page. Then delete one object/field at a time without saving till I find what is causing the problem.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You might also try to perform maintenance on your db. First make a copy, then do this:

1. Compact the database
2. Compile the database - from the VBA EDitor, click Debug - Compile. Fix any errors you find, and continue doing this until the menu item is disabled.
3. Compact again.

You might also need to decompile. To do that, create a shortcut with a Target like this:

"full path to msaccess.exe" "full path to your database" /decompile

Run this, then run the 3 steps above again.

You may also consider creating a new, blank database and importing everything to that new database. If you do this, be sure to run the 3 steps above on the new database.

Also make sure your Windows and Office installations are fully up to date.
This behavior occurs when the form on the tab is too large to be completely displayed.  The only solution I have found is to resize the subform so that it fits within the tab space.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

upobDaPlayaAuthor Commented:
Hi Pat,

What is a typical dimension where I would expect the dispaly to be fine.  In other words what would you recommend for the height and the width of the subform ?  Should the subform not exceed 12 inches as an example ?
It really depends on the monitors you are using.  You'll be able to use larger subforms on larger monitors or at lower resolution.
Michael CarrilloInformation Systems ManagerCommented:
The size of your subform is dependant on the number and size of the fields you have.  Keep in mind that you can have a subform within a subform.  However, you want to break up your fields into groups that are logically grouped together.  This encourages the user to continue completing the information needed. So you need to find a balance between a huge form with many fields and a form with many subforms and tabs that becomes confusing and/or hide needed information.

In your case you described Page two as being very large.  Perhaps you can break this page up into another tab or two.  Or even create a subform on page 2 and divide the fields into these subforms.
upobDaPlayaAuthor Commented:
What is the order of focus when I click on a page/tab and there are sub-forms within the page..Is it page/main form/sub form ?
Michael CarrilloInformation Systems ManagerCommented:
When you create objects on a form the newest object will have the highest tab order and the first object created will have the lowest tab order (first). Which is not necessarily what you want.

Naturally you should set this order yourself.  But the convention is top to bottom, left to right. I tend to put subforms at the bottom of the page.  But the logical order of the work should be your main guide.
upobDaPlayaAuthor Commented:
Hi macarrillo1,
I am referring to the OnFocus event..  If I set an OnFocus event on a Main Form, subform and a page/tab which OnFocus event will run first ?
Michael CarrilloInformation Systems ManagerCommented:
Since the Main Form gets focus first, it will run first.  If the Tab is within the subform, then the subform will run.  Keep in mind if you have a form with a subform and the subform has tabs within. When you open the form it will have focus.  If you then try to click the tab within the subform; the focus will first go to the subform then the tab. If the subforms are within the tabs then it is reversed.

Also, On focus occurs when you shift focus. So clicking on a subform moves the focus to the subform, even though from our perspective the parent form has focus too. The parent form does not have focus, the subform does.  I hope this helps.
upobDaPlayaAuthor Commented:
Whats interesting is I put a msgbox of "Hi" in any of the Event "OnClicK" within any of THE Page properties a Message of Hi will never appear.  However, if I place a msgbox of "Hi" in any of the Events "OnClicK" within THE Tab property then I receive the message of "Hi".

Why does this occur ?  Does MS Access really interpret me clicking on the page as really clicking on the Tab ?

Note I may have confused some of the terminology previously, but I have:
1 Tab property
5 Page properties
Multiple subforms within each of the 5 pages

Apologies for the confusion, but hopefully this now provides some clarity.
Have you tried resizing the subform yet?  The problem you describe is caused because the subform is too large.  It doesn't have anything to do with what gets the focus.

To determine the order in which events fire, place msgboxes in each event and display the event name.  Subforms load before the main form.  I'm not sure about the focus events.  I rarely put code in those events unless I am trying to control something visual.
upobDaPlayaAuthor Commented:
Thanks all for your patience and explanations to assist in my resolution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.