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!

Form TAB button code in OnClick procedure not working

Status
Not open for further replies.

Locoman

Technical User
Sep 25, 2002
38
GB
I have a long Form which is divided into manageable screen-sized chunks using three separate tab buttons. I want one of the tab buttons to run some code when pressed, however I have found that any perfectly valid code segement (tested with another command button)refuses to run when placed in the Click procedure for the tab button. No apparent error messages, just nothing!

I note that the procedure heading for the tab button is PAGE xxx_Click. Are these tab buttons special in any way so that you can't use the OnClick method as with other command buttons?
 
In the visual basic debugger, click on the procedure name then press the F9 key to add a breakpoint. Return to your form and try clicking on the tab.

If the code window doesn't appear, then it means it isn't firing when you think it is.
 
Use the OnChange event of the tab control rather than the OnClick event
 
How are ya Locoman . . . . .

It works but not like ya think. On Click [purple]works for the Page Area under the tab[/purple], not the Tab itself! So after you select the tab, then click the page area, [purple]it'll fire.[/purple]

You need to use the C[blue]hange Event[/blue], detecting selection of the proper page (remember they start at zero in VBA).
Code:
[blue]   IF Me!TabCtkName = [purple][b]YourPageNo [/b][/purple]then
      [green]'Your Code here![/green]
   End If[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top