Tab confusion

Tab confusion

Post by amFtZXNkZW » Wed, 31 Aug 2005 12:10:03

in Access 2003 I have a customer form with one control with several tabs.
Each of the tabs shows a seperate subform of a table which has a one-to-many
relationship on the customer form.

When switching between open forms using the Window option on the menu bar,
the tab control on the customer form is often confused when I return to it.
It might be showing one subform with the wrong tab shown as active. It might
show a piece of one subform with a piece of another subform. Usually I just
select through two or three (or more) different tabs, and the problem
eventually straightens itself out with both a tab and its corresponding
subform showing.

I am assuming that this is an Access or Windows issue, but would like to
know if there is anything which I can do to minimize the risk of this
happening? It's not a big deal, but annoying.


Tab confusion

Post by Arvin Meye » Wed, 31 Aug 2005 12:57:57

Try adding a bit of code in the Change event of the tab control:

Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:



Tab confusion

Post by amFtZXNkZW » Sat, 03 Sep 2005 12:01:02

I am not aware of a Change event on a tab control. There is a Change event
on a field, but this isn't appropriate. The problem doesn't have to do with
data changing, but with navigating between forms and clicking the tab
I added Me.Repaint to the Activate event of the main form which triggers
when switching between open forms, but I don't know if this is the solution
or not as the problem is sporadic. There is not an Activate event for the


Tab confusion

Post by Arvin Meye » Sat, 03 Sep 2005 19:45:31

In Design View, select the ENTIRE tab control, not just a page. Open the
property sheet and click on the Event tab. The first event is the Change

A tab control's Change event occurs when the tab pages are clicked. This is
where, you'd place code to deal with navigation between tab pages.
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:



Tab confusion

Post by amFtZXNkZW » Fri, 23 Sep 2005 07:15:05

hanks Arvin,
I will try it. Since it is sporadic, I may not know for a while if it works.
I am not aware of anything "unusual" that I am doing that causes this

I am thinking that it must be caused by something that needs reformated on
the subforms. For example, maybe you can't have the subform within a certain
margin of the edge of the tab control. Right now my Left property for each of
the tab controls is .0833. This is also the Left property for the subform. I
haven't tried to add a little "border" space between the two, but may try it
if Me.repaint doesn't work.

With such little feedback on this issue, I'm thinking that it doesn't happen
to other people, and so must be something within the formating of my

Anyway, thanks for the response


"Arvin Meyer [MVP]" wrote:


Tab confusion

Post by amFtZXNkZW » Sat, 24 Sep 2005 09:55:05

ell I just had it happen again with me.repaint in the TabFolders_Change
event. The problem occured when I did an Alt-Tab to switch between programs,
and when I returned to Access, the tab which was active changed to the
rightmost tab with the previously active tab data shown in the tab area. So
the tab which is shown as active and the data in the tab area don't match. I
got this to repeat several times consistantly by doing the same thing.
Something causes the active tab to change.

any other Ideas?

"Arvin Meyer [MVP]" wrote:


Tab confusion

Post by Arvin Meye » Tue, 27 Sep 2005 00:06:51

here is a margin which must be maintained between any control and the edges
of the tab control. As near as I can guess, it's very slightly under a
1/10th of an inch. Also, if your code uses SendKeys there can be very
unpredictable results when focus changes between applications. Moving
between programs using Alt+Tab would be a Windows issue.
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:

"jamesdeckert" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
active. It
Usually I


Tab confusion

Post by amFtZXNkZW » Wed, 05 Oct 2005 01:50:07

have added 1/10" margin and have still run into the problem. I am not using
Sendkeys (I have played with it but found it very unreliable).

I am using a routine to resize the form to the screen size from Access 2002
Desktop Developers Handbook (Litwin, Getz, Gunderloy) p. 558. The repaint
problem could be something here which has to do with not returning to the
same active tab as was active before. I could take the routine out, but
otherwise it is very nice and allows the form to resize the controls to fit
the current screen size without designing multiple forms. The routine is
fairly involved and haven't taken the time to try debugging.

thanks for all the help,

"Arvin Meyer [MVP]" wrote: