Tab Control On Click Event

S

SITCFanTN

I think this must be so simple because I can't find any other posts on this
exact topic so I appreciate any help you can give me.

I have a form with tab controls on it. What I want to accomplish is when a
tab is clicked, have the tab name fill in the "TASKID" field in the table
"tblQAData" for that record. One of the tabs is titled "Balancing". The
field "TASKID" is a dropdown, will that cause a problem with coding this? Do
I need to add the "TaskID" filed to the tab sheet to get it to prefill when
the tab is clicked or record saved? Any help you can provide is appreciated.
Thank You
 
Joined
Dec 17, 2007
Messages
57
Reaction score
0
SITCFanTN said:
I think this must be so simple because I can't find any other posts on this
exact topic so I appreciate any help you can give me.

I have a form with tab controls on it. What I want to accomplish is when a
tab is clicked, have the tab name fill in the "TASKID" field in the table
"tblQAData" for that record. One of the tabs is titled "Balancing". The
field "TASKID" is a dropdown, will that cause a problem with coding this? Do
I need to add the "TaskID" filed to the tab sheet to get it to prefill when
the tab is clicked or record saved? Any help you can provide is appreciated.
Thank You

I think the event is Change for Tab control.
Here is reference to Tab and Dynamic form, hope it may lead to an answer for you.
http://www.thescripts.com/forum/thread607247.html
 
D

Dale Fye

Try using the tabs Change event rather than the Click event.

You will then have to write some code that does what you want based on the
Value of the Tab control. Something like:

Private Sub tab_MyTab_Change

Select Case me.tab_MyTab.Value
Case 0
'put some code here for the 1st tab
Case 1
'put some code here for the 2nd tab
Case Else
'put some code here for all other tabs
End Select

End Sub

HTH
Dale
 
S

SITCFanTN

I don't understand, how would the code look to prefill the field that I
originally mentioned in my original post? Thanks
 
Joined
Dec 17, 2007
Messages
57
Reaction score
0
SITCFanTN said:
I don't understand, how would the code look to prefill the field that I
originally mentioned in my original post? Thanks

"Dale Fye" wrote:

> Try using the tabs Change event rather than the Click event.
>
> You will then have to write some code that does what you want based on the
> Value of the Tab control. Something like:
>
> Private Sub tab_MyTab_Change
>
> Select Case me.tab_MyTab.Value
> Case 0
> 'put some code here for the 1st tab
> Case 1
> 'put some code here for the 2nd tab
> Case Else
> 'put some code here for all other tabs
> End Select
>
> End Sub
>
> HTH
> Dale
> --
> Don''t forget to rate the post if it was helpful!
>
> email address is invalid
> Please reply to newsgroup only.
>
>
>
> "SITCFanTN" wrote:
>
> > I think this must be so simple because I can't find any other posts on this
> > exact topic so I appreciate any help you can give me.
> >
> > I have a form with tab controls on it. What I want to accomplish is when a
> > tab is clicked, have the tab name fill in the "TASKID" field in the table
> > "tblQAData" for that record. One of the tabs is titled "Balancing". The
> > field "TASKID" is a dropdown, will that cause a problem with coding this? Do
> > I need to add the "TaskID" filed to the tab sheet to get it to prefill when
> > the tab is clicked or record saved? Any help you can provide is appreciated.
> > Thank You

The only thing that Dale and I have mentioned regarding your situation is that the TABControl has a Change event that you should be using. TABControl doesn't use the Click event.

I thought you were having trouble with the code related to a Click event that wasn't working; and that you should be using the Change event.

It seems the issues are more about what exactly you are trying to do.

Could you describe what you are trying to do, and what you think the output should look like?
We have no idea what "tblQAData" or "TASKID" mean/represent.

Normally, you would have a Mainform. And. if you have a TabControl, you are usually dealing with subforms.
The name on the Tab is associated with the subform on the Tabcontrol.

The link I gave previously re Tabcontrol and Dynamic subform may be relevant to your situation.

Good luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top