Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set Focus for nested tabbing from subform to subform

Status
Not open for further replies.

lmcc007

Technical User
May 7, 2009
164
US

When I TAB from the txtPhoneExt control of the subform (s_frmPhoneNumbers), I want the next subform (Child22) control to become the active control. And If I keep tabbing I want Child23, Child24, and then go to another subform s_Addresses. I am doing this so I will not have to hit Control Tab all the time.


Below is the code I am using:


Private Sub txtPhoneExt_Exit(Cancel As Integer)


Dim rs As Object
Set rs = Me.Recordset.Clone
rs.MoveLast
If StrComp(Me.Bookmark, rs.Bookmark, 0) = 0 Then
Forms![s_frmPhoneNumbers1]![Child22].SetFocus

End If
End Sub

It works on the first subform going to Child22, but then I get the following error:

Runtime Error 3021:

No current record


I know I am missing something. I think it needs to loop or something until I get to the last subform, which is Child24 and then jump to s_Addresses after hitting tab, but I don’t know how to tell it to do that.

Help! Any suggestions?

Thanks!
 
I create an unbound text box called txtExit. IT is invisible and is last in tab order. This is the code I put in there:

Forms![frmMainForm]![frmSubSubForm].SetFocus
Forms![frmMainForm]![frmSubSubForm].Form![cboSubFormFirstCombo].SetFocus


I have one of these on each subform and the main form. I can tab through my entire universe seemlessly. HTH


misscrf

It is never too late to become what you could have been ~ George Eliot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top