Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab forms 1

Status
Not open for further replies.

TM2

Programmer
Jun 8, 2000
12
0
0
CA
Visit site
Hi, I was wondering if anyone can help me with a tabbed form.&nbsp;&nbsp;How do you specify which page you are on when coding?<br>
 
If you look in the objects list of the code window you'll see listing for the pages.&nbsp;&nbsp;Check for specific names by looking at the properties for the respective pages--best to rename them with meaningful titles.&nbsp;&nbsp;If you want to address the current page in code you'll probably need HasFocus property (not sure if pages have this property).
 
If you are new to tabbed forms, it might be best to think of each page as a separate view or grouping of controls on the same form. For example, page one may have controls listbox1 and combobox 1 and page two may have listbox2 and textfield2, but these are all controls on the same form. So, if you need to qualify the control you can prefix it with the tab form name. Like - Forms!tabformname!controlname. <br><br>Here is an example of using pages on TabCtl0 which is the primary tab control name. This is code behind the change event. I have this code in an application I just rolled out. The only time I needed to know the page was when controlling the flow between pages. In my case, the user is being forced to stop at a certain page to pick up a global key before moving on to another page. <br><br>Private Sub TabCtl0_Change()<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim tbc As control, pge As Page, oldPge As Page<br>&nbsp;&nbsp;&nbsp;&nbsp;' Return reference to tab control.<br>&nbsp;&nbsp;&nbsp;&nbsp;Set tbc = Me!TabCtl0<br>&nbsp;&nbsp;&nbsp;&nbsp;' Return reference to currently selected page.<br>&nbsp;&nbsp;&nbsp;&nbsp;Set pge = tbc.Pages(tbc.Value)<br>&nbsp;&nbsp;&nbsp;&nbsp;' Enumerate controls on currently selected page.<br>&nbsp;&nbsp;&nbsp;&nbsp;''--Debug.Print &quot;Page Name = &quot;; pge.Name<br>&nbsp;&nbsp;&nbsp;&nbsp;''--Debug.Print &quot;Last Page Name = &quot;; glbLastPage<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;If (pge.Name = &quot;Shop Order List&quot;) Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;glbLastPage = pge.Name<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Exit Sub<br>&nbsp;&nbsp;&nbsp;&nbsp;Else<br>&nbsp;&nbsp;&nbsp;&nbsp;'--- Always go to the Equipment form to get the equipment Number<br>&nbsp;&nbsp;&nbsp;&nbsp;'--- when coming from the shop order<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If glbLastPage = &quot;tpShopOrder&quot; Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Forms!MotorDataEntry!tabsubformEquipment.SetFocus<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;glbLastPage = pge.Name<br>End Sub<br>
 
for future readers...

tabMyTabCtl.Pages(tabMyTabCtl.Value)
is *always* the currently-selected page of the tab control called tabMyTabCtl. The .Value property of a TabControl is *always* the .PageIndex property of the selected page. -- C Vigil =)
(Before becoming a member, I also signed on several posts as
&quot;JustPassingThru&quot; and &quot;QuickieBoy&quot; -- as in &quot;Giving Quick Answers&quot;)
 
Hi, I'm having refresh problems with activex controls hosted within the pages of a standard Access tab control.

I've placed listview controls in each page of a four page tab. Yet the *first* time I select each tab the listview control, whilst running the form, the listview is not displayed in it's orginal location (as in design view).
Thereafter, clicking back to the same page, everything is normal?

Any ideas?
 
After much investigation, I discovered that although Access tab control is a container for other controls, it works very poorly with more complex controls, such as the listview control.

The best way around the problem that I had, was not to actually insert the listview control into the tab control, rather place it over it (i.e on the form) and hide/display it according to which tab is being clicked. You'll have to remember to setfocus as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top