tab stop, subforms, and focus

D

DawnTreader

Hello

i am one frustrated Access user.

i am currently trying to make a subform change the focus to the subform that
it is on so that the user can continue to enter data. the subsubform is on a
tab control that is in a subform that is on a tab control on the main form. i
have used the following code in the onfocus event:

Private Sub cntTabExit_GotFocus()
'setting focus on the next field in the main form

Forms![zzMAINFORM]![ctlfrmsubdatatblCompressor].Form!_[CoolingMethod].SetFocus
End Sub

this works great. until i try to go into the same subsubform on a new
record. then the subsubform acts as though it is locked.

there is other code in the ondirty event of the form. i dont believe that
this is a cause.

i have been thinking that the code is working the first time, but then the
focus in the subsubform is still on the control that causes the jump to the
subform and because it is on that jumping control it automatically jumps out
again. can anyone confirm this? and if you can, is there some code or some
way of making it possible to get back into this form? what is even worse is
after tabbing through the subform and the subsubform on the first record, on
any other records it tabs from my main form to the subform to the control i
specified for the subsubform to move to.

any help or ideas would be appreciated.
 
M

Marshall Barton

DawnTreader said:
i am currently trying to make a subform change the focus to the subform that
it is on so that the user can continue to enter data. the subsubform is on a
tab control that is in a subform that is on a tab control on the main form. i
have used the following code in the onfocus event:

Private Sub cntTabExit_GotFocus()
'setting focus on the next field in the main form

Forms![zzMAINFORM]![ctlfrmsubdatatblCompressor].Form!_[CoolingMethod].SetFocus
End Sub

this works great. until i try to go into the same subsubform on a new
record. then the subsubform acts as though it is locked.

there is other code in the ondirty event of the form. i dont believe that
this is a cause.

i have been thinking that the code is working the first time, but then the
focus in the subsubform is still on the control that causes the jump to the
subform and because it is on that jumping control it automatically jumps out
again. can anyone confirm this? and if you can, is there some code or some
way of making it possible to get back into this form? what is even worse is
after tabbing through the subform and the subsubform on the first record, on
any other records it tabs from my main form to the subform to the control i
specified for the subsubform to move to.


What a coincendence, the next thing on my to do list is the
same kind arrangement. The trick I have in mind is to use
the subsubform **control** Enter event to set the focus the
the first control in the subsubform.

It may not be necessary, but I prefer to save any changes
before leaving the subsubform. The code in the dummy exit
text box:
If Me.Dirty Then Me.Dirty = False
Parent.CoolingMethod.SetFocus
 

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