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

Tab Control Problem 1

Status
Not open for further replies.

BanditLV

Programmer
Oct 17, 2000
50
US
I've created a form using a Tab Control that allows viewing different aspects of a client... However, for some reason, I am unable to get the coding of OnClick of a specific tab within the Tab Control to requery subform within that Tab Control (or even a subform under a different Tab Control)... Has anyone worked with the Tab Control feature in Access 97 and know how to get the On Click to activate code?
 
There must be another avenue to running the routine, e.g., Form Current, Form Update, etc. Maybe even an event within the subform used to initiate the requery. Elaborate on your procedures and maybe you'll get one of the heavyweights to respond. . .
 
Quick note - discovered the situation as to why the above problem didn't work, so for those of you who are needing the answer, here it is...

You can't use the Events on the specific Tabs on the Tab Control... You have to use the Events on the Tab Control itself... So far, all that I have found that worked is On Change, but everytime a tab is clicked on, it goes through On Change...

Sometimes, life is just too simple... I feel like such a ditz...

Best programming to you all!

Roy aka BanditLV
Las Vegas
 
Thanks for the solution. How can one address a specific tab name so that On change you could test for the current tab?
 
Thanks for the post Bandit, you just saved me some money on aspirin!
 
For accessing a specific tab we set up a table of tabNames with a tabIndex + 1 value:

tabValue tabName
-------- --------
0 tabName1
1 tabName2
2 tabName3
3 tabName4
4 tabName5

Then on the form you could get the tab name something like this

dim rs as recordset
dim strSQL as string
dim sName as string

strSQL = "SELECT tabName FROM tabNameTable WHERE tabValue = " & me.tabPageObject.TabIndex

set rs = currentdb.openrecordset(strSQL, dbopensnapshot)

sName = rs!tabName

then just use a case statement on the sName.

Of course, if you are not that energetic you could just make a case statement that uses the tabindex or value.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top