Setting Focus to a command button within a Tab form

  • Thread starter Thread starter DKI
  • Start date Start date
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.
 
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.
 
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.
 
Back
Top