Full Version: Setting Focus on Control on Sub-SubForm from SubForm
UtterAccess Forums > Microsoft® Access > Access Forms
niesz
This question stems from curiosity more than anything. If you are on the middle form of a Form-SubForm-SubSubForm setup and want to more focus to a control on the SubSubForm, what is the most efficient way to do this?
o far the only way I can achieve this is to set focus on the MainForm, then back to the SubForm, then on to the SubSubForm, then to the control.
It just seems like you should be able to set focus right to the SubForm, and then to the control.
See attachment...
I thought I had enough coffee today, but they brewed some crazy off brand instead of the good stuff here at work. dazed.gif
strive4peace
here is an example you can adapt to your situation
etFocus to a control on another subform
I use the OnKeyPress event of the control you want to jump to another -- set up to test for TAB key press
CODE
Private Sub Controlname_KeyPress(KeyAscii As Integer)
   If KeyAscii = 9 Then
      Me.Parent.SubformControlname.SetFocus  
      Me.Parent.SubformControlname.form.Controlname_on_nextsubform.SetFocus
   End If
End Sub

this is preferable to doing this automatically when you exit the control as you may want to specifically click somewhere else...
niesz
Sorry, Crystal.
till no go. Even with:
Me.Parent.frmLevel2.SetFocus
Me.Parent.frmLevel2.Form.frmLevel3.SetFocus
Me.Parent.frmLevel2.Form.frmLevel3.Form.Textbox1.SetFocus
(see previously attached DB)
..I still cannot get focus to move directly to the Sub-Subform control from the SubForm. I've tried all variations of
Forms.MainForm.SubForm.Form.SubSubForm.....
Me.Parent.SubForm.Form.SubSubForm.....
Me.Subform.....
..but still cannot get it to move DIRECTLY from the middle form to the third subform Form , to the CONTROL on the third subform.
I guess it one of those things.
strive4peace
Hi Walter,
will look at this later and see if I can figure something out
niesz
Don't spend too much time on it. I just thought there should be an easier way than what I had to do.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.