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
|
|||
|
|||
List controls on a tab page?
Hi,
I have a form that has a tab strip with 4 or 5 tabs on it. I'm trying to write some code that will list all the controls on a specific tab page. I can get it to loop through all controls on the form, but I can't seem to narrow it down to the tab page in question. Any thoughts? Thanks, John |
#2
|
|||
|
|||
List controls on a tab page?
the following code will loop through the controls on each tabpage of the
named tab control, as Dim tPage As Page, ctl As Control For Each tPage In Me!TabCtl0.Pages For Each ctl In tPage.Controls MsgBox tPage.Name & ": " & ctl.Name Next Next if, instead, you want to specify what page the code should loop through, use Dim tPage As Page, ctl As Control Set tPage = Me!TabCtl0.Pages("PageName") For Each ctl In tPage.Controls MsgBox tPage.Name & ": " & ctl.Name Next in either case, replace TabCtl0 with the correct name of your tab control, and in the second case, replace PageName with the correct name of the page you're concerned with. hth "John" wrote in message ng.com... Hi, I have a form that has a tab strip with 4 or 5 tabs on it. I'm trying to write some code that will list all the controls on a specific tab page. I can get it to loop through all controls on the form, but I can't seem to narrow it down to the tab page in question. Any thoughts? Thanks, John |
#3
|
|||
|
|||
List controls on a tab page?
and btw, "queries" in this newsgroup name refers to Access queries, that is,
SQL statements. you might have done better to post this particular question to microsoft.public.access.modulesdaovba newsgroup. not a major issue, it's just good to keep in mind which newsgroup is most focused on the central theme of your question when choosing where to post. hth "tina" wrote in message ... the following code will loop through the controls on each tabpage of the named tab control, as Dim tPage As Page, ctl As Control For Each tPage In Me!TabCtl0.Pages For Each ctl In tPage.Controls MsgBox tPage.Name & ": " & ctl.Name Next Next if, instead, you want to specify what page the code should loop through, use Dim tPage As Page, ctl As Control Set tPage = Me!TabCtl0.Pages("PageName") For Each ctl In tPage.Controls MsgBox tPage.Name & ": " & ctl.Name Next in either case, replace TabCtl0 with the correct name of your tab control, and in the second case, replace PageName with the correct name of the page you're concerned with. hth "John" wrote in message ng.com... Hi, I have a form that has a tab strip with 4 or 5 tabs on it. I'm trying to write some code that will list all the controls on a specific tab page. I can get it to loop through all controls on the form, but I can't seem to narrow it down to the tab page in question. Any thoughts? Thanks, John |
#4
|
|||
|
|||
List controls on a tab page?
On Nov 24, 11:34*pm, "tina" wrote:
and btw, "queries" in this newsgroup name refers to Access queries, that is, SQL statements. you might have done better to post this particular question to microsoft.public.access.modulesdaovba newsgroup. not a major issue, it's just good to keep in mind which newsgroup is most focused on the central theme of your question when choosing where to post. hth "tina" wrote in message ... the following code will loop through thecontrolson each tabpage of the namedtabcontrol, as * * Dim tPage As Page, ctl As Control * * For Each tPage In Me!TabCtl0.Pages * * * * For Each ctl In tPage.Controls * * * * * * MsgBox tPage.Name & ": *" & ctl.Name * * * * Next * * Next if, instead, you want to specify what page the code should loop through, use * * Dim tPage As Page, ctl As Control * * Set tPage = Me!TabCtl0.Pages("PageName") * * For Each ctl In tPage.Controls * * * * MsgBox tPage.Name & ": *" & ctl.Name * * Next in either case, replace TabCtl0 with the correct name of yourtabcontrol, and in the second case, replace PageName with the correct name of the page you're concerned with. hth "John" wrote in message ing.com... Hi, I have a form that has atabstrip with 4 or 5 tabs on it. I'm trying to write some code that willlistall thecontrolson a specifictabpage. I can get it to loop through allcontrolson the form, but I can't seem to narrow it down to thetabpage in question. Any thoughts? Thanks, John- Hide quoted text - - Show quoted text - Thanks - that worked perfectly |
#5
|
|||
|
|||
List controls on a tab page?
you're welcome
wrote in message ... On Nov 24, 11:34 pm, "tina" wrote: and btw, "queries" in this newsgroup name refers to Access queries, that is, SQL statements. you might have done better to post this particular question to microsoft.public.access.modulesdaovba newsgroup. not a major issue, it's just good to keep in mind which newsgroup is most focused on the central theme of your question when choosing where to post. hth "tina" wrote in message ... the following code will loop through thecontrolson each tabpage of the namedtabcontrol, as Dim tPage As Page, ctl As Control For Each tPage In Me!TabCtl0.Pages For Each ctl In tPage.Controls MsgBox tPage.Name & ": " & ctl.Name Next Next if, instead, you want to specify what page the code should loop through, use Dim tPage As Page, ctl As Control Set tPage = Me!TabCtl0.Pages("PageName") For Each ctl In tPage.Controls MsgBox tPage.Name & ": " & ctl.Name Next in either case, replace TabCtl0 with the correct name of yourtabcontrol, and in the second case, replace PageName with the correct name of the page you're concerned with. hth "John" wrote in message ing.com... Hi, I have a form that has atabstrip with 4 or 5 tabs on it. I'm trying to write some code that willlistall thecontrolson a specifictabpage. I can get it to loop through allcontrolson the form, but I can't seem to narrow it down to thetabpage in question. Any thoughts? Thanks, John- Hide quoted text - - Show quoted text - Thanks - that worked perfectly |
Thread Tools | |
Display Modes | |
|
|