If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Making tabs invisible
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. |
#2
|
|||
|
|||
Making tabs invisible
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." wrote: 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. |
#3
|
|||
|
|||
Making tabs invisible
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" wrote: 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." wrote: 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. |
#4
|
|||
|
|||
Making tabs invisible
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" wrote: 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." wrote: 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. |
#5
|
|||
|
|||
Making tabs invisible
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 Regards Neville Turbit www.projectperfect.com.au "Jim L." wrote: 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" wrote: 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." wrote: 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. |
#6
|
|||
|
|||
Making tabs invisible
This
MS Office can't find the macro 'If Me![TabA]="A" then Me!TabA.' indicates that you've placed the code you've been given 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 in the Property box of the combobox in the Properties sheet, when the names of macros are normally entered in order to be run. The code above needs to be placed in... that's right! In the code module, not in the property box! -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200907/1 |
#7
|
|||
|
|||
Making tabs invisible
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" wrote: 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 Regards Neville Turbit www.projectperfect.com.au "Jim L." wrote: 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" wrote: 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." wrote: 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. |
Thread Tools | |
Display Modes | |
|
|