Go to first tab

C

Carl Mankat

I am running Access 2K on a W2K OS.

I should know this but I am missing something.

I have form1 with a combo box(combo0) for Name and a command button
(Command2) which opens a second form2 based upon the name selected in
the combo box.

On the resulting form I have two command buttons, Command1 (go to main
menu), and Command2 (return to form1). When the control is returned to
Form1 the Command2 has focus. I want to return to form1 I want to have
combo0 in focus.

I have tried DoCmd.GoToRecord, , acFirst and Me.[combo0].SetFocus and a
few other variations to no avail. What am I missing?

TIA,

Carl
 
C

Carl Mankat

I tried the following code and it choked. I used Current

Private Sub Form_Current()
Me.TabControl =1
End Sub

wHERE SHOULD i PLACE THE EVENT?

cARL

Rob said:
Set the value of the tab control to 1.

e.g. me.tabcontrol=1



I am running Access 2K on a W2K OS.

I should know this but I am missing something.

I have form1 with a combo box(combo0) for Name and a command button
(Command2) which opens a second form2 based upon the name selected in
the combo box.

On the resulting form I have two command buttons, Command1 (go to main
menu), and Command2 (return to form1). When the control is returned to
Form1 the Command2 has focus. I want to return to form1 I want to have
combo0 in focus.

I have tried DoCmd.GoToRecord, , acFirst and Me.[combo0].SetFocus and a
few other variations to no avail. What am I missing?

TIA,

Carl
 
R

Rob Oldfield

me. refers to the form that's calling the code so that would be why that's
not working... something like...

forms!thenameofyourform1!tabcontrol=1



Carl Mankat said:
I tried the following code and it choked. I used Current

Private Sub Form_Current()
Me.TabControl =1
End Sub

wHERE SHOULD i PLACE THE EVENT?

cARL

Rob said:
Set the value of the tab control to 1.

e.g. me.tabcontrol=1



I am running Access 2K on a W2K OS.

I should know this but I am missing something.

I have form1 with a combo box(combo0) for Name and a command button
(Command2) which opens a second form2 based upon the name selected in
the combo box.

On the resulting form I have two command buttons, Command1 (go to main
menu), and Command2 (return to form1). When the control is returned to
Form1 the Command2 has focus. I want to return to form1 I want to have
combo0 in focus.

I have tried DoCmd.GoToRecord, , acFirst and Me.[combo0].SetFocus and a
few other variations to no avail. What am I missing?

TIA,

Carl
 
V

Van T. Dinh

I am not even sure Carl has a TabControl on the first Form. He might have
meant the first Control in the tabbing order.

BTW, the first TabPage has index zero so if the Focus needs to be set to it,
you should set the value of the TabControl to 0 and not 1.
--
HTH
Van T. Dinh
MVP (Access)



Rob Oldfield said:
me. refers to the form that's calling the code so that would be why that's
not working... something like...

forms!thenameofyourform1!tabcontrol=1



Carl Mankat said:
I tried the following code and it choked. I used Current

Private Sub Form_Current()
Me.TabControl =1
End Sub

wHERE SHOULD i PLACE THE EVENT?

cARL

Rob said:
Set the value of the tab control to 1.

e.g. me.tabcontrol=1




I am running Access 2K on a W2K OS.

I should know this but I am missing something.

I have form1 with a combo box(combo0) for Name and a command button
(Command2) which opens a second form2 based upon the name selected in
the combo box.

On the resulting form I have two command buttons, Command1 (go to main
menu), and Command2 (return to form1). When the control is returned to
Form1 the Command2 has focus. I want to return to form1 I want to have
combo0 in focus.

I have tried DoCmd.GoToRecord, , acFirst and Me.[combo0].SetFocus and
a
few other variations to no avail. What am I missing?

TIA,

Carl
 
V

Van T. Dinh

Not sure but my guess is that you leave Form1 open when you open Form2. If
this is the canse, you should add the statement:

Forms!Form1.Combo0.SetFocus

as the last statement in the code for the Command2 in Form2.
 
R

Rob Oldfield

I wonder where my brain went. Reread the thread and you are, of course,
correct.


Van T. Dinh said:
I am not even sure Carl has a TabControl on the first Form. He might have
meant the first Control in the tabbing order.

BTW, the first TabPage has index zero so if the Focus needs to be set to it,
you should set the value of the TabControl to 0 and not 1.
--
HTH
Van T. Dinh
MVP (Access)



Rob Oldfield said:
me. refers to the form that's calling the code so that would be why that's
not working... something like...

forms!thenameofyourform1!tabcontrol=1



Carl Mankat said:
I tried the following code and it choked. I used Current

Private Sub Form_Current()
Me.TabControl =1
End Sub

wHERE SHOULD i PLACE THE EVENT?

cARL

Rob Oldfield wrote:

Set the value of the tab control to 1.

e.g. me.tabcontrol=1




I am running Access 2K on a W2K OS.

I should know this but I am missing something.

I have form1 with a combo box(combo0) for Name and a command button
(Command2) which opens a second form2 based upon the name selected in
the combo box.

On the resulting form I have two command buttons, Command1 (go to main
menu), and Command2 (return to form1). When the control is returned to
Form1 the Command2 has focus. I want to return to form1 I want to have
combo0 in focus.

I have tried DoCmd.GoToRecord, , acFirst and Me.[combo0].SetFocus and
a
few other variations to no avail. What am I missing?

TIA,

Carl
 
C

Carl Mankat

Thanks Van (and the others), that worked. I found I could also have used
Me!Combo0.SetFocus since the Form2 was active.

Carl
 

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