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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unprovoked page change in tab control.... 1

Status
Not open for further replies.

GWhiz

Programmer
Dec 16, 1999
49
US
Hi, folks!<br>
<br>
Ran across an annoying problem when using a tab control:<br>
<br>
When on any page other than page 0 (the first page of a multiple-page tab control), and &quot;Remove Filter/Sort&quot; is selected (either from right-click pop-up menu or menu bar selection at top of screen), tab control always resets to first page (page index 0).<br>
<br>
This is annoying, especially when working on another page, and selecting &quot;Remove Filter/Sort&quot; applies to the page you're working on.<br>
<br>
Does anyone know how to keep the tab control from defaulting back to the first page when &quot;Remove Filter/Sort&quot; is selected?<br>
<br>
Thanks for any suggestions...<br>
<br>
Respectfully,<br>
<br>
Doug<br>
<br>

 
Do NOT use Filter/Sort<br>
Write something more powerful using VBA<br>
What is the Final Result here?<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
 
Tnx for your response, Doug.<br>
<br>
In this app, customer wants a series of general purpose browse tables that he can configure/sort/filter on the fly.<br>
<br>
I have set him up another page on the tab control for this purpose. There are at least 10 tables there, selectable from a combo box.<br>
<br>
It is unpredictable which tables he will be accessing or how he wants the info grouped, sorted, or filtered at any given time. On any given table, he might apply a filter, then remove it.<br>
<br>
But he gets annoyed whenever he removes a filter, then gets blasted back to page index 0.<br>
<br>
I guess I can put a command button on there and remove any applied filter/sort through code. Haven't tried that yet, so don't know if it will also cause reset to page index 0.<br>
<br>
Will try tonite...<br>
<br>
Tnx again...<br>
<br>

 
much later than original post, but for future readers...

Context for this reply: Access 97

I believe that the Remove Filter/Sort applies to the whole form (main form). That is certainly how a form/subform worked for me a couple of weeks ago. Most frustrating.

And when a Filter is applied (or removed, I'll bet), the Form_Current for the filtered form fires again (as well as the OnFilter and OnApplyFilter events). I just ran into that today. I have a form with a subform, related through parent/child fields, so changing the record in the main form re-filters the subform. Code that I had in the sub-form's Form_Current event handler was firing up to four times!!! This caused much wasted time and processing, and I discovered that it was because of the OnApplyFilter event being fired on every record change, causing the Form_Current to fire again. I'm not really sure why it sometimes happened more times and sometimes fewer. Anyway, my fix:
Code:
'Global to form
Dim fApplyFilterFired as boolean

Private Sub Form_ApplyFilter()
    fApplyFilterFired = True
End Sub

Private Sub Form_Current()
    If (fApplyFilterFired) Then
        fApplyFilterFired = False 'reset for next time
    Else
        'Run my code that caused lots of screen flickering
        'when it changed the order and visibility of pages
        'on the TabControl.
    End If
End Sub

This makes sure that Form_Current doesn't run the &quot;real&quot; code if ApplyFilter ran immediately before. And I have noticed, without confirming just why, that Form_Current does always fire at least once after the last time Form_FilterApply forces it to fire.
-- 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;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top