Minty
AWF VIP
- Local time
- Today, 07:42
- Joined
- Jul 26, 2013
- Messages
- 10,371
Hi All, I've been battling with a conundrum for a while on and off, and am going to admit defeat, at least for now.
I have a Main form that has two subforms on it. Form one on the left side is a list based continuous form, that drives the data available on SubForm 2. All very straight forward.
The edit form has a number of tab pages on it. These tabbed pages are not always all visible, depending on certain data in the form. Again this all works tickety boo, and is driven by the current event on the sub form.
And now the issue. When switching between the items on the list form I would like Form 2 to remain on the tab page selected previously.
It looks very roughly like below; (I really am rubbish at mock ups, and can't post the actual db very easily it's all tied up with client data and a remote backend.)
What I have tried - A unbound control on the main holding form that is set to the tabcontrol page value on the tab change event. This works almost, except that changing tabs fires the current event and the change event of the tab control as well and messes the whole thing up. When debugging this is what I see in the immediate window, the number shown is Me.tabOtherData.Value
Debug.Print Event & page index
Clicking on the Tab for page index 3
Tab Change 3
Tab Change 0
Tab Change 3
Current 3
Clicking on the Tab for page index 4
Tab Change 4
Tab Change 0
Tab Change 4
Current 4
Now the really weird one
Clicking on the Tab for page index 0
Tab Change 0
Tab Change 3
Tab Change 0
Tab Change 3
Current 3
It ends up back on tab page index 3...
So why is the tabchange event firing multiple times, and why is the current event firing at all?
I suspect it is to do with hiding some of the pages, but the event that drives that shouldn't be being triggered.
I am going to try and knock up a more meaningful actual demo in the meantime but have been too busy messing around with it.
Edit :
The On current event is firing twice once on initial change and once again after the tab hiding goes on so something weird is going on.
I have a Main form that has two subforms on it. Form one on the left side is a list based continuous form, that drives the data available on SubForm 2. All very straight forward.
The edit form has a number of tab pages on it. These tabbed pages are not always all visible, depending on certain data in the form. Again this all works tickety boo, and is driven by the current event on the sub form.
And now the issue. When switching between the items on the list form I would like Form 2 to remain on the tab page selected previously.
It looks very roughly like below; (I really am rubbish at mock ups, and can't post the actual db very easily it's all tied up with client data and a remote backend.)
What I have tried - A unbound control on the main holding form that is set to the tabcontrol page value on the tab change event. This works almost, except that changing tabs fires the current event and the change event of the tab control as well and messes the whole thing up. When debugging this is what I see in the immediate window, the number shown is Me.tabOtherData.Value
Debug.Print Event & page index
Clicking on the Tab for page index 3
Tab Change 3
Tab Change 0
Tab Change 3
Current 3
Clicking on the Tab for page index 4
Tab Change 4
Tab Change 0
Tab Change 4
Current 4
Now the really weird one
Clicking on the Tab for page index 0
Tab Change 0
Tab Change 3
Tab Change 0
Tab Change 3
Current 3
It ends up back on tab page index 3...
So why is the tabchange event firing multiple times, and why is the current event firing at all?
I suspect it is to do with hiding some of the pages, but the event that drives that shouldn't be being triggered.
I am going to try and knock up a more meaningful actual demo in the meantime but have been too busy messing around with it.
Edit :
The On current event is firing twice once on initial change and once again after the tab hiding goes on so something weird is going on.
Last edited: