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

Is using 12 ADODC controls with SSTab a good idea???

Status
Not open for further replies.

MarcMellor

Programmer
Jan 12, 2002
34
US
I am trying to put different selections of information from the same database into different MSHFlexGrids on different Tabs of an SSTab control. I initially assumed that clicking, say, Tab 3 would fire an event for which I could write code for my ADODC control to make a particular selection from the connected database. But I cannot find any reference to any particular chosen Tab so I have resorted to a new ADODC control on every one of the 12 Tabs I need. My gut feeling is that this is not good practice!!!I've seen in a book that there is a PreviousTab Keyword, so there may be a CurrentTab Keyword but I can't really think how I can write code so that the program 'knows' that the current Tab is Tab 3 so that I can specify exactly what selection the ADODC control should make from the database.
Thinking on my feet - would this get somewhere:
Private Sub SSTab1_Click(CurrentTab As Integer)
Select Case CurrentTab
Case 0
ADODC1.RecordSource = "SELECT(*) FROM .. WHERE ..etc
Case1
ADODC1.RecordSource = "SELECT(*) FROM .. WHERE ..etc
Any Thoughts??



 
NOt really clear on your confusion. There is a CLICK event for each "TAB" as in:

Private Sub PageN_Click()

where
N is the tab number

There is also a "Change" event of the control wic may be used to Get the "Current Tab" when any of the tabe is clicked, as in:

Private Sub TabCtl0_Change()
Debug.Print TabCtl0.Value & " Change"
End Sub


produces:

0 Change
1 Change
2 Change
3 Change
4 Change

NOTE at the Tab # is ZERO based

MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Thanks MichaelRed, but my confusion is probably largely my amateur status! When I put the SSTab control on a form I can only FIND various events associated with SSTab1 (eg _Click, _DblClick etc). I have tried simply writing some code starting
Private Sub Page0_Click
Adodc1.RecordSource = "SELECT .. FROM ..WHERE.."
Adodc1.Refresh
End Sub
etc. but there is no change when I switch from tab to tab.
I have successfully used my own suggestion above but there is a problem. The SSTab1_Click (PreviousTab As Integer) event does make changes to my Selection but I think one step behind, i.e. to the previous tab. I have tried simply rewriting the click event as SSTab1_Click (CurrentTab As Integer) but it seems to ignore it.
I'm afraid your other suggestion I don't understand well enough to actually turn into usable code.
any further thoughts?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top