Linking Combo Box in Page Header to One of 4 Tabbed Subforms in the Detail Section

MamadouNdaw

Registered User.
Local time
Today, 18:02
Joined
Nov 14, 2007
Messages
17
After a long hiatus, I'm getting back to learning access. So, I have 4 subforms each within a tab control. In addition, I have a combo box located in the page header. I would like the tab to automatically switch upon changing the combo box to a specified value. If someone can offer me some kind of code snippet to accomplish this, I'd greatly appreciate it.

It's much easier to learn on a per case basis by working through code and seeing how it works. Of course, until you have enough of a base to write from scratch.

Thanks guys
 
Simple Software Solutions

Ok

On the AfterUpdate of your combo box

Dim nIndex as Integer
Select Case Me.ComboBox

Case x : nIndex = 0

Case y : nIndex = 1

Case z : nIndex = 2

End Select

What we have done above is to pass a value to a variable based on the item selected in the combo box, this could be the bound column or any other column (if more than one column has been defined).

Next we need to switch to the sub forms. Lets work on the pretext you only have one subform with one tab control

Forms("MainForm")("Subform").TabControl.Tab = nIndex

This will make the tab control display the tab page based on the index value of the tab control.

CodeMaster::cool:http://www.icraftlimited.co.uk
 
Where do I place that second line of code relating to Form and Subform? Well, I attached my entire database to give someone an opportunity to see what a mess it is.

But, the form in question is frmTransaction. You will see that there are many variations of the transaction subform as I am experimenting with different ideas, but the one with the 4 tabs is the one mentioned above. The combo box is the one on top named TransactionType.

Any constructive criticism is welcome.

NOTE: The attached database is Office 2007 format. Also, the file is double compressed. Zip on the outside, RAR on the inside. It was too big for zip alone. Don't worry, it is clean.
 

Attachments

Users who are viewing this thread

Back
Top Bottom