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

Adding a tab control to an existing form with tabbed controls

100+
P: 109
Sorry for the mouthful of a title!

Basically, I have a form with tabbed controls (Personal/Contact Details, Referral Information, Case Info/Status etc.) and I want to add a tabbed control form inside one of the existing tabs.

At the moment there are two tabs called Appointments and Group Appointments. What I want to do is add a tabbed control inside the Appointments tab with two tabs called Individual Appointments and Group Appointments so it looks tidier!

I have tried to do it in the usual way of adding a tabbed control from the toolbox and then cutting and pasting stuff onto it but when I switch to form view the newly added tab (which I only want to display inside the Appointments tab!) shows up over all of the existing tabs and covers the form. Is there a way to do make it so it only appears on the Appointments tab? I've tried to find out by googling and poking around Access using trial and error but I've not been able to do it. It's probably something glaringly obvious!

I'm using Access 2000.

Thanks in advance
Gareth
Oct 28 '09 #1

✓ answered by OldBirdman

I think I understand what you've done. You have 2 tab controls on your form, TabCtl8(Tabs="Personal/Contact Details"; "Referral Information"; "Case Info/Status"; "Appointments"; etc) and TabCtlAppts(Tabs="Individual"; "Group").
TabCtlAppts is positioned so that if .Visible=True, it appears to be a control on TabCtl8.
However, if I update anything on the Group tab inside TabCtlAppts, when I click back to the Individual tab, TabCtlAppts disappears!
Try this. In form Design mode, click on TabCtlAppts, then on the menu bar, Format->Bring to Front.
Your code
Expand|Select|Wrap|Line Numbers
  1. If Me!TabCtl8.Value = 3 Then ...
should work as it is in the OnChange Event of TabCtl8, as long as the "Appointments" tab is the 4th tab. It should NOT be anywhere else.

Share this Question
Share on Google+
19 Replies


missinglinq
Expert 2.5K+
P: 3,532
You can't add a tabbed control to a tabbed control, directly. You only alternative, which is kind of clunky, is to add a subform to your Appointments tab, then add a tabbed control to this subform.

If it was me, I'd just have two separate pages on your exiting tabbed control, one for group and one for individual appointments.

Linq ;0)>
Oct 28 '09 #2

100+
P: 109
Hmm, I was thinking this was more hassle than it's worth. The problem with adding a subform to the Appointments tab is that it already contains a subform so things are going to get messy aren't they?

I was thinking, couldn't I have an if statement to make then nested tab control only appear when the Appointments tab is selected? It's a bit of a botch job but in theory it'd work?

Anyway, thanks for your help. I guess I'll just stick to two tabs

EDIT: I played around with the OnChange event of the tabbed control the new tabbed control will be inside and managed to get it to display only on the Appointments tab!
Oct 29 '09 #3

100+
P: 109
Okay, now I have a new problem. I managed to get everything working fine and the new tabbed control (TabCtlAppts) only displays in the Appointments tab as required.

However, if I update anything on the Group tab inside TabCtlAppts, when I click back to the Individual tab, TabCtlAppts disappears!

I have tried adding the same code in the OnChange event of the main tabbed control (TabCtl8) into different parts and events of TabCtlAppts but it has proved fruitless thus far. This is the code for what it's worth:
Expand|Select|Wrap|Line Numbers
  1. If Me!TabCtl8.Value = 3 Then
  2.     Me!TabCtlAppts.Visible = True
  3.     Else
  4.     Me!TabCtlAppts.Visible = False
  5.     End If
This is really annoying me as I've almost got it done but there's just this one hurdle left (until another crops up no doubt...)
Oct 29 '09 #4

100+
P: 109
I can't edit my previous post but just wanted to add that on the form's Current event, TabCtlAppts.Visible is set to false obviously...

I'm thinking this might be the issue. I also forgot to add that although TabCtlAppts disappears, if I click to another tab on the main tabbed control (TabCtl8) and then click back to the Appointments tab, it reappears. The only time it disappears is when any of the information is changed on the Group tab in TabCtlAppts. This is really annoying!

EDIT: Really need to stop posting as I'm messing around with this! I added the If statement in the above post to the form's Current event (and removed the Visible setting I did have) and it worked! Although the page seems to flicker like it's trying to fight it.

Seems I answered my own question just by typing it out on here... I think! Look out for another post where I've somehow broken something now...
Oct 29 '09 #5

Expert 100+
P: 1,287
It sounds like the flickering may be caused by two different events setting the control to Visible = False, then back to Visible = True immediately afterwards.
Oct 29 '09 #6

100+
P: 109
I think you may be right. I have the same If statment in two places (on the form's Current event and on TabCtl8's OnChange event). If I remove one though, the problem of it disappearing occurs still.

A bit of flickering never hurt anyone, right?!
Oct 29 '09 #7

100+
P: 675
I think I understand what you've done. You have 2 tab controls on your form, TabCtl8(Tabs="Personal/Contact Details"; "Referral Information"; "Case Info/Status"; "Appointments"; etc) and TabCtlAppts(Tabs="Individual"; "Group").
TabCtlAppts is positioned so that if .Visible=True, it appears to be a control on TabCtl8.
However, if I update anything on the Group tab inside TabCtlAppts, when I click back to the Individual tab, TabCtlAppts disappears!
Try this. In form Design mode, click on TabCtlAppts, then on the menu bar, Format->Bring to Front.
Your code
Expand|Select|Wrap|Line Numbers
  1. If Me!TabCtl8.Value = 3 Then ...
should work as it is in the OnChange Event of TabCtl8, as long as the "Appointments" tab is the 4th tab. It should NOT be anywhere else.
Oct 29 '09 #8

100+
P: 109
That's the situation, I'm glad I managed to explain it properly!

Just so I understand, all I need to do is Format -> Bring to Front on TabCtlAppts to what I have already? (keeping both If statements in OnChange of TabCtl8 and Current of the form?)

I've tried this but it doesn't appear to have done anything...

Thanks for your help though!

EDIT: It helps if I read your post properly. I removed the If statement from the form's Current event and it's done just the job.

Thanks to everyone, total heroes!
Oct 30 '09 #9

topher23
Expert 100+
P: 234
OB, you've made me feel like a complete idiot. Here I've been using Access for nearly 10 years and never even noticed "Bring to Front" and "Send to Back" in Format. I've actually been cutting controls and pasting them back in in order to bring them to the front. D'oh!
Oct 30 '09 #10

100+
P: 675
Don't flatter yourself. Lacking one fact does not make you a COMPLETE idiot.

I frequently want a tab control on a tab control, and I too was doing cut/paste to make the control the last thing added to the form, and therefore "on top". But it doesn't always work, does it? Then I found a reference to "Send to Back"/"Bring to Front", and realized that this worked for me always.

The purpose of forums is to share. The titbits of info keep me reading posts that have nothing to do with anything I'll ever do. Sometimes I remember these. Sometimes I share. Sometimes I ask. Such are forums.
Oct 30 '09 #11

NeoPa
Expert Mod 15k+
P: 31,471
It seems a shame there is no VBA equivalent for that OB.

Also note that ListBox & SubForm controls cannot be sent behind other controls.
Nov 1 '09 #12

100+
P: 675
I know. Using this tool to control one listbox in front of another may result in the appearance of correct, but selecting a row in the 'front' listbox may in fact cause the hidden listbox to have the 'focus'. This may or may not cause the two listboxes to display correctly.

Having a 'tab control' on a tab page seems is like a very reasonable thing to want. Access should allow it. Also, having one control on all the tab pages is reasonable and desirable. "Clear This Tab" would be such a case, or standard filters for a sub-form would be another. This tool works well for these applications, and is at least worth trying whenever a front/back situation exists for controls. It is easier to try than repeatedly deleting and recreating a control to see if it comes to the 'front'.
Nov 2 '09 #13

Expert 100+
P: 1,287
Well, I'm disappointed to find that we can't change the zOrder of controls at runtime. Any suggestions I have seen recommend using SetFocus to bring an object to the front, but that doesn't actually change its order permanently. I haven't given up on finding a workaround. I don't use Bring To Front / Send To Back much in Access, but I don't know how I would work without it for fancy PowerPoint stuff.
Nov 2 '09 #14

NeoPa
Expert Mod 15k+
P: 31,471
I don't mean to imply that this isn't a good solution to the problem OB. Not perfect maybe, but a good solution for most requirements here.

I simply mention the downsides, as I think anyone coming to the subject fresh would need to be warned that the scope for taking it further is limited in those respects.
Nov 3 '09 #15

100+
P: 675
My first answer was addressing the question raised by OP. As I frequently want do do exactly what he wanted, to put a control on a TabControl on a TabControl Page, I supplied an answer, which when all the details were attended to, worked for him.

As a General Case solution, no, it is not complete. There are serious limitations in Access regarding which is in front of what. Creation order, Focus, type of control, and "Bring to Front" all work to determine the display at any point in time.

Also note that ListBox & SubForm controls cannot be sent behind other controls.
Not entirely a true statement either. A ListBox can be behind another ListBox. However, the results may be unpredictable. If two listboxes overlap, and an item is selected in the front listbox, Access may move focus to the back listbox and only move the selected row of that back listbox to the front, not the entire listbox. i.e. Only the selected row is in front, not the entire control.

My experience is that the only control that is reliably in front of everything is the dropdown part of a ComboBox. By hiding the textbox portion of the combo, this can be made to work as a ListBox that is ALWAYS ON TOP.
Nov 3 '09 #16

NeoPa
Expert Mod 15k+
P: 31,471
As I said, my post was in no way intended as a criticism. I explained this fully in my previous post.

As for the clarification you give on what can and cannot be moved back and forth, that too is helpful. I simply did a little digging (as I was interested in your solution and wanted to look into a code-based version of it). What I found in Help was what I posted. The fact that it isn't 100% reliable surprises me less than it should, but your clarification does exactly for my post what I was attempting to do for yours. Anyone reviewing the thread should now get the full story, which is all good.
Nov 3 '09 #17

100+
P: 109
I'd also like to add that I'm glad, in a way, that this wasn't a newbish question in the end. This thread has actually made for interesting reading when I just expected it to be my lack of experience with Access that was letting me down!

For me, using Access for the first time in years, has been a massive trial and error situation and I've basically learned everything (again) as I've been toying around with the database.

Thanks again guys.
Nov 3 '09 #18

NeoPa
Expert Mod 15k+
P: 31,471
No worries. It's fun to come back after a while away huh?

Anyway, No. This wasn't a newbish question.
Nov 3 '09 #19

100+
P: 109
It's fun when everything comes together! Not so fun when you get stuck at something that seems obvious.

Although, my supervisor has just asked me to do something else which has made my brain hurt so expect another thread imminently. Well, tomorrow!
Nov 3 '09 #20

Post your reply

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