A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Visibility 2



 
 
Thread Tools Display Modes
  #1  
Old December 12th, 2008, 08:25 PM posted to microsoft.public.access.tablesdbdesign
Tom
external usenet poster
 
Posts: 1,359
Default Visibility 2

Maybe I'm not expessing myself adequately. My form has many "Tabs". I want
to only have one "Visible" based on the information contained in a
"Department" field on the main section of the form. Several different
departments, each with a related tab for data.

Example, Engineering in department field, only engineering tab shows....
  #2  
Old December 12th, 2008, 09:16 PM posted to microsoft.public.access.tablesdbdesign
Beetle
external usenet poster
 
Posts: 1,254
Default Visibility 2

I would suggest using a combo box for selecting the department (if you're
not doing that already), then you could code the After Update event of the
combo box to show or hide tabs based on what is selected.

For example, suppose you have a combo box named cboDepartment and
a tab control named TabCtl0 with Engineering on the first tab and Science
on the second tab. The code might look like;

Private Sub cboDepartment_AfterUpdate

Me.TabCtl0.Pages(0).Visible = Me.cboDepartment = "Engineering"
Me.TabCtl0.Pages(1).Visible = Me.cboDepartment = "Science"

End Sub

The Page index is zero based, so the first tab is Page(0), the second is
Page(1), etc.

The reason I suggest a combo box is that if you use a text box and the
user misspells something, you may end up with none of your tabs visible.

--
_________

Sean Bailey


"Tom" wrote:

Maybe I'm not expessing myself adequately. My form has many "Tabs". I want
to only have one "Visible" based on the information contained in a
"Department" field on the main section of the form. Several different
departments, each with a related tab for data.

Example, Engineering in department field, only engineering tab shows....

  #3  
Old December 12th, 2008, 10:01 PM posted to microsoft.public.access.tablesdbdesign
Tom
external usenet poster
 
Posts: 1,359
Default Visibility 2

Beetle.... Works Almost perfectly. If I change the description in my
department drop down, the appropriate tab becomes visible. However, in the
older records my department value is already established and the tabs do not
change as I go from department to department.....(unless I change the value,
and go back)

Thoughts??

"Beetle" wrote:

I would suggest using a combo box for selecting the department (if you're
not doing that already), then you could code the After Update event of the
combo box to show or hide tabs based on what is selected.

For example, suppose you have a combo box named cboDepartment and
a tab control named TabCtl0 with Engineering on the first tab and Science
on the second tab. The code might look like;

Private Sub cboDepartment_AfterUpdate

Me.TabCtl0.Pages(0).Visible = Me.cboDepartment = "Engineering"
Me.TabCtl0.Pages(1).Visible = Me.cboDepartment = "Science"

End Sub

The Page index is zero based, so the first tab is Page(0), the second is
Page(1), etc.

The reason I suggest a combo box is that if you use a text box and the
user misspells something, you may end up with none of your tabs visible.

--
_________

Sean Bailey


"Tom" wrote:

Maybe I'm not expessing myself adequately. My form has many "Tabs". I want
to only have one "Visible" based on the information contained in a
"Department" field on the main section of the form. Several different
departments, each with a related tab for data.

Example, Engineering in department field, only engineering tab shows....

  #4  
Old December 12th, 2008, 10:13 PM posted to microsoft.public.access.tablesdbdesign
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Visibility 2

Put that same code to set the visibility into the form's Current event.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Tom" wrote in message
...
Beetle.... Works Almost perfectly. If I change the description in my
department drop down, the appropriate tab becomes visible. However, in
the
older records my department value is already established and the tabs do
not
change as I go from department to department.....(unless I change the
value,
and go back)

Thoughts??

"Beetle" wrote:

I would suggest using a combo box for selecting the department (if you're
not doing that already), then you could code the After Update event of
the
combo box to show or hide tabs based on what is selected.

For example, suppose you have a combo box named cboDepartment and
a tab control named TabCtl0 with Engineering on the first tab and Science
on the second tab. The code might look like;

Private Sub cboDepartment_AfterUpdate

Me.TabCtl0.Pages(0).Visible = Me.cboDepartment = "Engineering"
Me.TabCtl0.Pages(1).Visible = Me.cboDepartment = "Science"

End Sub

The Page index is zero based, so the first tab is Page(0), the second is
Page(1), etc.

The reason I suggest a combo box is that if you use a text box and the
user misspells something, you may end up with none of your tabs visible.

--
_________

Sean Bailey


"Tom" wrote:

Maybe I'm not expessing myself adequately. My form has many "Tabs". I
want
to only have one "Visible" based on the information contained in a
"Department" field on the main section of the form. Several different
departments, each with a related tab for data.

Example, Engineering in department field, only engineering tab
shows....



  #5  
Old December 12th, 2008, 10:16 PM posted to microsoft.public.access.tablesdbdesign
Beetle
external usenet poster
 
Posts: 1,254
Default Visibility 2

Try duplicating the code in your form's Current event, then test
to make sure it works like you want.
--
_________

Sean Bailey


"Tom" wrote:

Beetle.... Works Almost perfectly. If I change the description in my
department drop down, the appropriate tab becomes visible. However, in the
older records my department value is already established and the tabs do not
change as I go from department to department.....(unless I change the value,
and go back)

Thoughts??

"Beetle" wrote:

I would suggest using a combo box for selecting the department (if you're
not doing that already), then you could code the After Update event of the
combo box to show or hide tabs based on what is selected.

For example, suppose you have a combo box named cboDepartment and
a tab control named TabCtl0 with Engineering on the first tab and Science
on the second tab. The code might look like;

Private Sub cboDepartment_AfterUpdate

Me.TabCtl0.Pages(0).Visible = Me.cboDepartment = "Engineering"
Me.TabCtl0.Pages(1).Visible = Me.cboDepartment = "Science"

End Sub

The Page index is zero based, so the first tab is Page(0), the second is
Page(1), etc.

The reason I suggest a combo box is that if you use a text box and the
user misspells something, you may end up with none of your tabs visible.

--
_________

Sean Bailey


"Tom" wrote:

Maybe I'm not expessing myself adequately. My form has many "Tabs". I want
to only have one "Visible" based on the information contained in a
"Department" field on the main section of the form. Several different
departments, each with a related tab for data.

Example, Engineering in department field, only engineering tab shows....

  #6  
Old December 12th, 2008, 10:38 PM posted to microsoft.public.access.tablesdbdesign
Tom
external usenet poster
 
Posts: 1,359
Default Visibility 2

When I do, it tells me I can't hide a control that has the focus

"Douglas J. Steele" wrote:

Put that same code to set the visibility into the form's Current event.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Tom" wrote in message
...
Beetle.... Works Almost perfectly. If I change the description in my
department drop down, the appropriate tab becomes visible. However, in
the
older records my department value is already established and the tabs do
not
change as I go from department to department.....(unless I change the
value,
and go back)

Thoughts??

"Beetle" wrote:

I would suggest using a combo box for selecting the department (if you're
not doing that already), then you could code the After Update event of
the
combo box to show or hide tabs based on what is selected.

For example, suppose you have a combo box named cboDepartment and
a tab control named TabCtl0 with Engineering on the first tab and Science
on the second tab. The code might look like;

Private Sub cboDepartment_AfterUpdate

Me.TabCtl0.Pages(0).Visible = Me.cboDepartment = "Engineering"
Me.TabCtl0.Pages(1).Visible = Me.cboDepartment = "Science"

End Sub

The Page index is zero based, so the first tab is Page(0), the second is
Page(1), etc.

The reason I suggest a combo box is that if you use a text box and the
user misspells something, you may end up with none of your tabs visible.

--
_________

Sean Bailey


"Tom" wrote:

Maybe I'm not expessing myself adequately. My form has many "Tabs". I
want
to only have one "Visible" based on the information contained in a
"Department" field on the main section of the form. Several different
departments, each with a related tab for data.

Example, Engineering in department field, only engineering tab
shows....




  #7  
Old December 12th, 2008, 10:53 PM posted to microsoft.public.access.tablesdbdesign
Beetle
external usenet poster
 
Posts: 1,254
Default Visibility 2

Set the focus back to the combo box before you hide the tabs;

Private Sub Form_Current

Me.cboDepartment.SetFocus
Me.TabCtl0.Pages(0).Visible = Me.cboDepartment = "Engineering"
Me.TabCtl0.Pages(1).Visible = Me.cboDepartment = "Science"

End Sub

--
_________

Sean Bailey


"Tom" wrote:

When I do, it tells me I can't hide a control that has the focus

"Douglas J. Steele" wrote:

Put that same code to set the visibility into the form's Current event.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Tom" wrote in message
...
Beetle.... Works Almost perfectly. If I change the description in my
department drop down, the appropriate tab becomes visible. However, in
the
older records my department value is already established and the tabs do
not
change as I go from department to department.....(unless I change the
value,
and go back)

Thoughts??

"Beetle" wrote:

I would suggest using a combo box for selecting the department (if you're
not doing that already), then you could code the After Update event of
the
combo box to show or hide tabs based on what is selected.

For example, suppose you have a combo box named cboDepartment and
a tab control named TabCtl0 with Engineering on the first tab and Science
on the second tab. The code might look like;

Private Sub cboDepartment_AfterUpdate

Me.TabCtl0.Pages(0).Visible = Me.cboDepartment = "Engineering"
Me.TabCtl0.Pages(1).Visible = Me.cboDepartment = "Science"

End Sub

The Page index is zero based, so the first tab is Page(0), the second is
Page(1), etc.

The reason I suggest a combo box is that if you use a text box and the
user misspells something, you may end up with none of your tabs visible.

--
_________

Sean Bailey


"Tom" wrote:

Maybe I'm not expessing myself adequately. My form has many "Tabs". I
want
to only have one "Visible" based on the information contained in a
"Department" field on the main section of the form. Several different
departments, each with a related tab for data.

Example, Engineering in department field, only engineering tab
shows....




  #8  
Old December 12th, 2008, 11:14 PM posted to microsoft.public.access.tablesdbdesign
Tom
external usenet poster
 
Posts: 1,359
Default Visibility 2

That did it...

Thnax Mucho

"Beetle" wrote:

Set the focus back to the combo box before you hide the tabs;

Private Sub Form_Current

Me.cboDepartment.SetFocus
Me.TabCtl0.Pages(0).Visible = Me.cboDepartment = "Engineering"
Me.TabCtl0.Pages(1).Visible = Me.cboDepartment = "Science"

End Sub

--
_________

Sean Bailey


"Tom" wrote:

When I do, it tells me I can't hide a control that has the focus

"Douglas J. Steele" wrote:

Put that same code to set the visibility into the form's Current event.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Tom" wrote in message
...
Beetle.... Works Almost perfectly. If I change the description in my
department drop down, the appropriate tab becomes visible. However, in
the
older records my department value is already established and the tabs do
not
change as I go from department to department.....(unless I change the
value,
and go back)

Thoughts??

"Beetle" wrote:

I would suggest using a combo box for selecting the department (if you're
not doing that already), then you could code the After Update event of
the
combo box to show or hide tabs based on what is selected.

For example, suppose you have a combo box named cboDepartment and
a tab control named TabCtl0 with Engineering on the first tab and Science
on the second tab. The code might look like;

Private Sub cboDepartment_AfterUpdate

Me.TabCtl0.Pages(0).Visible = Me.cboDepartment = "Engineering"
Me.TabCtl0.Pages(1).Visible = Me.cboDepartment = "Science"

End Sub

The Page index is zero based, so the first tab is Page(0), the second is
Page(1), etc.

The reason I suggest a combo box is that if you use a text box and the
user misspells something, you may end up with none of your tabs visible.

--
_________

Sean Bailey


"Tom" wrote:

Maybe I'm not expessing myself adequately. My form has many "Tabs". I
want
to only have one "Visible" based on the information contained in a
"Department" field on the main section of the form. Several different
departments, each with a related tab for data.

Example, Engineering in department field, only engineering tab
shows....



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.