Making tabs invisible

J

Jim L.

I am working on a form (Form1) that has 2 tab controls (TabA, TabB).
ComboBox M has a value list of A, B or C. I have set both tab control pages
"Visible" properties to "No". If a user selects "A" in ComboBoxM, I would
like TabA to become visible. If "B" or "C" is selected, both tabs would
remain invisible.
I have looked through this site, and found that I should enter
"Me![TabA].Visible=Me![ComboBoxM]="A"" in ComboBoxM's After Update property
(without the beginning & ending quotes). However, when I try this, I get an
error message saying "Microsoft Office can't find the macro 'Me!ComboBoxM.'
Do I need to write a macro to do this, then set the After Update property to
the macro name? If so, how do I write the macro?
I don't know anything about writing code, so please keep your answers for
the simple of mind.
Thanks Much.
 
N

NevilleT

Hi Jim

Try this

If Me![ComboBoxM] = "A" then
Me![TabA].Visible = True
else
Me![TabA].Visible = False
End If

You get the idea. You can add the other tabs into this or another If
statement.

Neville Turbit
www.projectperfect.com.au
 
J

Jim L.

Hi Neville,
I wrote exactly what you put into the After Update property of ComboBoxM,
but I'm still getting the error saying MS Office can't find the macro 'If
Me![TabA]="A" then Me!TabA.'
Am I supposed to enter this in some kind of a macro instead of directly in
the combo box property? If so, what do I set the macro actions to?
Thanks again.

NevilleT said:
Hi Jim

Try this

If Me![ComboBoxM] = "A" then
Me![TabA].Visible = True
else
Me![TabA].Visible = False
End If

You get the idea. You can add the other tabs into this or another If
statement.

Neville Turbit
www.projectperfect.com.au

Jim L. said:
I am working on a form (Form1) that has 2 tab controls (TabA, TabB).
ComboBox M has a value list of A, B or C. I have set both tab control pages
"Visible" properties to "No". If a user selects "A" in ComboBoxM, I would
like TabA to become visible. If "B" or "C" is selected, both tabs would
remain invisible.
I have looked through this site, and found that I should enter
"Me![TabA].Visible=Me![ComboBoxM]="A"" in ComboBoxM's After Update property
(without the beginning & ending quotes). However, when I try this, I get an
error message saying "Microsoft Office can't find the macro 'Me!ComboBoxM.'
Do I need to write a macro to do this, then set the After Update property to
the macro name? If so, how do I write the macro?
I don't know anything about writing code, so please keep your answers for
the simple of mind.
Thanks Much.
 
J

Jim L.

One more quick question if I may?
I have 2 text boxes ([ReportNumber1] & [ReportNumber2]) on this same form,
both with a different control source from the query (the report numbers are
related, but go into different tables). If [ComboBoxM] ="A", I would like
[ReportNumber2] to equal [ReportNumber1]. How can I write this Iif statement
so if [ComboBoxM]="B" or "C", [ReportNumber2] will remain null (something
like...=Iif(([ComboBoxA]="A"),[ReportNumber1],Null)...). I tried it this
way, and I get the same error message about not being able to find the macro.
Do I write the expression in the "Default Value" property of [ReportNumber2]
so the control source remains intact?

NevilleT said:
Hi Jim

Try this

If Me![ComboBoxM] = "A" then
Me![TabA].Visible = True
else
Me![TabA].Visible = False
End If

You get the idea. You can add the other tabs into this or another If
statement.

Neville Turbit
www.projectperfect.com.au

Jim L. said:
I am working on a form (Form1) that has 2 tab controls (TabA, TabB).
ComboBox M has a value list of A, B or C. I have set both tab control pages
"Visible" properties to "No". If a user selects "A" in ComboBoxM, I would
like TabA to become visible. If "B" or "C" is selected, both tabs would
remain invisible.
I have looked through this site, and found that I should enter
"Me![TabA].Visible=Me![ComboBoxM]="A"" in ComboBoxM's After Update property
(without the beginning & ending quotes). However, when I try this, I get an
error message saying "Microsoft Office can't find the macro 'Me!ComboBoxM.'
Do I need to write a macro to do this, then set the After Update property to
the macro name? If so, how do I write the macro?
I don't know anything about writing code, so please keep your answers for
the simple of mind.
Thanks Much.
 
N

NevilleT

Hi Jim
I built the form as you described it and it works. I am using the following
code.

Private Sub Form_Open(Cancel As Integer)
Me.ComboBoxM = ""
End Sub

Private Sub ComboBoxM_AfterUpdate()
If Me.ComboBoxM = "A" Then
Me.TabA.Visible = True
Me.ReportNumber2 = Me.ReportNumber1
Else
Me.TabA.Visible = False
End If
End Sub

Note that I set the combobox value to blank when the form opens. If you
want a copy of the database, send me your email address to
(e-mail address removed)

Regards

Neville Turbit
www.projectperfect.com.au

Jim L. said:
One more quick question if I may?
I have 2 text boxes ([ReportNumber1] & [ReportNumber2]) on this same form,
both with a different control source from the query (the report numbers are
related, but go into different tables). If [ComboBoxM] ="A", I would like
[ReportNumber2] to equal [ReportNumber1]. How can I write this Iif statement
so if [ComboBoxM]="B" or "C", [ReportNumber2] will remain null (something
like...=Iif(([ComboBoxA]="A"),[ReportNumber1],Null)...). I tried it this
way, and I get the same error message about not being able to find the macro.
Do I write the expression in the "Default Value" property of [ReportNumber2]
so the control source remains intact?

NevilleT said:
Hi Jim

Try this

If Me![ComboBoxM] = "A" then
Me![TabA].Visible = True
else
Me![TabA].Visible = False
End If

You get the idea. You can add the other tabs into this or another If
statement.

Neville Turbit
www.projectperfect.com.au

Jim L. said:
I am working on a form (Form1) that has 2 tab controls (TabA, TabB).
ComboBox M has a value list of A, B or C. I have set both tab control pages
"Visible" properties to "No". If a user selects "A" in ComboBoxM, I would
like TabA to become visible. If "B" or "C" is selected, both tabs would
remain invisible.
I have looked through this site, and found that I should enter
"Me![TabA].Visible=Me![ComboBoxM]="A"" in ComboBoxM's After Update property
(without the beginning & ending quotes). However, when I try this, I get an
error message saying "Microsoft Office can't find the macro 'Me!ComboBoxM.'
Do I need to write a macro to do this, then set the After Update property to
the macro name? If so, how do I write the macro?
I don't know anything about writing code, so please keep your answers for
the simple of mind.
Thanks Much.
 
J

Jim L.

Neville,
I looked around and noticed the code builder option in the After Update
property, so now I understand where to place the code. I entered the code
you gave me, and all aspects are working great. Now I think I may be able to
begin applying so many of these posts I have ignored, because they include
code. You've opened my reluctant eyes.
Thanks for the help

NevilleT said:
Hi Jim
I built the form as you described it and it works. I am using the following
code.

Private Sub Form_Open(Cancel As Integer)
Me.ComboBoxM = ""
End Sub

Private Sub ComboBoxM_AfterUpdate()
If Me.ComboBoxM = "A" Then
Me.TabA.Visible = True
Me.ReportNumber2 = Me.ReportNumber1
Else
Me.TabA.Visible = False
End If
End Sub

Note that I set the combobox value to blank when the form opens. If you
want a copy of the database, send me your email address to
(e-mail address removed)

Regards

Neville Turbit
www.projectperfect.com.au

Jim L. said:
One more quick question if I may?
I have 2 text boxes ([ReportNumber1] & [ReportNumber2]) on this same form,
both with a different control source from the query (the report numbers are
related, but go into different tables). If [ComboBoxM] ="A", I would like
[ReportNumber2] to equal [ReportNumber1]. How can I write this Iif statement
so if [ComboBoxM]="B" or "C", [ReportNumber2] will remain null (something
like...=Iif(([ComboBoxA]="A"),[ReportNumber1],Null)...). I tried it this
way, and I get the same error message about not being able to find the macro.
Do I write the expression in the "Default Value" property of [ReportNumber2]
so the control source remains intact?

NevilleT said:
Hi Jim

Try this

If Me![ComboBoxM] = "A" then
Me![TabA].Visible = True
else
Me![TabA].Visible = False
End If

You get the idea. You can add the other tabs into this or another If
statement.

Neville Turbit
www.projectperfect.com.au

:

I am working on a form (Form1) that has 2 tab controls (TabA, TabB).
ComboBox M has a value list of A, B or C. I have set both tab control pages
"Visible" properties to "No". If a user selects "A" in ComboBoxM, I would
like TabA to become visible. If "B" or "C" is selected, both tabs would
remain invisible.
I have looked through this site, and found that I should enter
"Me![TabA].Visible=Me![ComboBoxM]="A"" in ComboBoxM's After Update property
(without the beginning & ending quotes). However, when I try this, I get an
error message saying "Microsoft Office can't find the macro 'Me!ComboBoxM.'
Do I need to write a macro to do this, then set the After Update property to
the macro name? If so, how do I write the macro?
I don't know anything about writing code, so please keep your answers for
the simple of mind.
Thanks Much.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top