Setting Focus to a command button within a Tab form

D

DKI

I have a main form and on that form I have inserted a tab form called TabCtl0.

TabCtl0 has several command buttons on the third tab (Page3). My question
is If I open another form and then close that form how do I set focus to one
of the command buttons on Page3.
 
M

Marshall Barton

DKI said:
I have a main form and on that form I have inserted a tab form called TabCtl0.

TabCtl0 has several command buttons on the third tab (Page3). My question
is If I open another form and then close that form how do I set focus to one
of the command buttons on Page3.

The same way you would if there were no tab control.

If you open the other form in dialog mode (using the
OpenForm method's WindowMode argument), then you can put:
Me.[some command button].SetFocus
immediately after the Open form line.
 
T

Terra

Marsh,

I hope you can help me, I have the same problem sort of....you see I have a
form and on this form is a button, when clicked it goes to another form and
is filtered to the initial forms ContactID number. This works great, however
I need it to also set the focus to a tabed form and go to the page 6, which
is tab labled "SalesInfo". Here is my code...
Private Sub Command134_Click()
On Error GoTo Err_Command134_Click
Dim strFrmContacts As String

strFrmContacts = "frmContacts"
DoCmd.OpenForm strFrmContacts
With Forms(strFrmContacts)
.Filter = ""
.Filter = "ContactID = " & txtSrBOID
.FilterOn = True
End With

Exit_Command134_Click:
Exit Sub
Err_Command134_Click:
MsgBox Err.Description
Resume Exit_Command134_Click
End Sub

How to I add the SetFocus command and where do I put it...

Thanks in advance!
TLH

Marshall Barton said:
DKI said:
I have a main form and on that form I have inserted a tab form called TabCtl0.

TabCtl0 has several command buttons on the third tab (Page3). My question
is If I open another form and then close that form how do I set focus to one
of the command buttons on Page3.

The same way you would if there were no tab control.

If you open the other form in dialog mode (using the
OpenForm method's WindowMode argument), then you can put:
Me.[some command button].SetFocus
immediately after the Open form line.
 

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