List controls on a tab page?

J

John

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
 
T

tina

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
 
T

tina

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
 
J

jrtwynam

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












- Show quoted text -

Thanks - that worked perfectly :)
 
T

tina

you're welcome :)


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












- Show quoted text -

Thanks - that worked perfectly :)
 
Top