Link to home
Start Free TrialLog in
Avatar of upobDaPlaya
upobDaPlaya

asked on

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.
SOLUTION
Avatar of Michael Carrillo
Michael Carrillo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of upobDaPlaya
upobDaPlaya

ASKER

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.
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.
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 ?
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.
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 ?
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.
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.
Thanks all for your patience and explanations to assist in my resolution.