How do you program tab controls from visible to not visible?

  • Thread starter Thread starter Christine
  • Start date Start date
C

Christine

I have a form with five tabs/pages.

A main switchboard form(which I'll call Form A) has 4
buttons that call the same form (Form B). However,
depending on the button that is selected, I want Form B to
display only certain tabs/pages, each of which gets and
displays data from the same table. For example:

In Form A,
if you press... Form B displays....

Button 1 Tab/Page 1
Button 2 Tab/Page 1 and 2
Button 3 Tab/Page 1, 2 and 3
Button 4 Tab/Page 1, 2, 3 and 4

I can't figure out how or where to write the code to do
this. Any help will be greatly appreciated!

Christine
 
Hi Jon. Well, I entered the code you provided in both Form
A and Form B. However, when I click on Button 1 in Form 1,
I get "Run-time error '424': object required".

In Form B, the tab controls are labelled as follows:
Tab1: caption = Tab1
name = Tab1

Tab2: caption = Tab2
name = Tab2

etc.

In the "debug" area of FormB it says TabMain = Empty.
Pages says "You entered an expression that has an invalid
reference to the prop..." (Can't read the rest of the
message). Me.OpenArgs = 1.

If I select the entire tab control, it says it is called
TabCtl0. (Access set this name, not me.)

I've tried searching for help for the tabMain command, but
Access doesn't provide any information. I've also tried
changing the Pages(0) to Pages("Tab1"), and other such
varients with no success.

Can you please help?
 
Sorry - I just answered my own question. "tabMain" refers
to the name of the entire tab control!. HOWEVER, the code
still isn't working. If I press Btn1 in FormA, FormB
displays only Tab1. But if you press Btn2 (or any other
button in FormA), FormB still only displays Tab1.

I've tried resetting the tabs in FormB by adding the
following to On Unload, On Deactiviate and OnClose without
success.

tabMain.Pages(0).Visible = True
tabMain.Pages(1).Visible = True
tabMain.Pages(2).Visible = True
tabMain.Pages(3).Visible = True

Continued help welcome!

Christine
 
Back
Top