Page tab control (1 Viewer)

Eljefegeneo

Still trying to learn
Local time
Yesterday, 17:38
Joined
Jan 10, 2011
Messages
904
I have tried to use the various page tab control events to no avail. They just don't seem to work at all. All I want to do it to clear several unbound text boxes on a tab page when I click on the tab control. I know that I can click anywhere on the page to get the desired result, but I want to be able to click on the tab. Is there any way of doing this? It is only needed for one tab. Why are the five events there anyway if they don't function?
 

John Big Booty

AWF VIP
Local time
Today, 10:38
Joined
Aug 29, 2005
Messages
8,263
Are you looking at Object Tabs or a Tab control on a form?

 

Eljefegeneo

Still trying to learn
Local time
Yesterday, 17:38
Joined
Jan 10, 2011
Messages
904
I am looking at what you have circled. So I guess they are the Tab controls on a form. There are five events associated with a tab. I hope I am speaking about the right thing.
 

Eljefegeneo

Still trying to learn
Local time
Yesterday, 17:38
Joined
Jan 10, 2011
Messages
904
I've attached a simple DB that shows what I am trying to do. The form in the Db has a further explanation. I know that there are all kinds of way to do this, I just want to make it so easy that even my users who are not very computer literate can use it.
 

Attachments

  • TabControl1.accdb
    432 KB · Views: 47

John Big Booty

AWF VIP
Local time
Today, 10:38
Joined
Aug 29, 2005
Messages
8,263
OK, you where using the Page's On Click event, which only fires when the body of the page is clicked.

You need to put the following code in the Tab Controls On Click event;
Code:
Private Sub TabCtl14_Click()

If TabCtl14.Value = 0 Then
    Me.TS1 = ""
    Me.TS2 = ""
    Me.TS3 = ""
    Me.TS4 = ""
    Me.TS5 = ""
End If

End Sub
 

Attachments

  • TabControl1.zip
    48 KB · Views: 42

Eljefegeneo

Still trying to learn
Local time
Yesterday, 17:38
Joined
Jan 10, 2011
Messages
904
I see what you have done, and please correct me if I am wrong. You have to identify the page with the If TabCtl14.Value = Page Index, then you can add the code. Thanks again. Saved me time and now I can delete the code from other places - I had it in the OnClose event for the report. Not a great place to have it.
 

John Big Booty

AWF VIP
Local time
Today, 10:38
Joined
Aug 29, 2005
Messages
8,263
It's not strictly necessary, you could put the code without the If Then and it would simply run whenever the user clicked on any of the tabs.

I put it in more as an illustration of how you could determine which of the tabs was clicked :)
 

Users who are viewing this thread

Top Bottom