Solved

Ms Access Form brings me to the middle of the subform

Posted on 2014-11-02
13
263 Views
Last Modified: 2014-11-23
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.
0
Comment
Question by:upobDaPlaya
  • 5
  • 4
  • 3
  • +1
13 Comments
 
LVL 9

Assisted Solution

by:macarrillo1
macarrillo1 earned 167 total points
ID: 40418829
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.
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 167 total points
ID: 40419214
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.
0
 
LVL 34

Accepted Solution

by:
PatHartman earned 166 total points
ID: 40419841
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.
0
 

Author Comment

by:upobDaPlaya
ID: 40436459
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 ?
0
 
LVL 34

Expert Comment

by:PatHartman
ID: 40436496
It really depends on the monitors you are using.  You'll be able to use larger subforms on larger monitors or at lower resolution.
0
 
LVL 9

Expert Comment

by:macarrillo1
ID: 40436597
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.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:upobDaPlaya
ID: 40441761
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 ?
0
 
LVL 9

Expert Comment

by:macarrillo1
ID: 40441851
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.
0
 

Author Comment

by:upobDaPlaya
ID: 40444041
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 ?
0
 
LVL 9

Expert Comment

by:macarrillo1
ID: 40444087
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.
0
 

Author Comment

by:upobDaPlaya
ID: 40445957
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.
0
 
LVL 34

Expert Comment

by:PatHartman
ID: 40446493
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.
0
 

Author Closing Comment

by:upobDaPlaya
ID: 40461421
Thanks all for your patience and explanations to assist in my resolution.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now