Rachel,
Obviously I agree that you have a highly complex situation and endorse the previous advice to simplify if possible.....
But to address the mechanics of where you are stuck,
Move between Tabs, there are some variations which may seem complicated due to your complex situation. But there is logic so stay with me..
First you understand that you have Parent form. It seems that some of the fields from the Parent recordset may be grouped on individual tabs because of shortage of space.
This is the most simple case, where the next field you want to move to belongs to the same recordset i.e. not in a new sub-form. You just put some code in the Lost Focus event of the last field on your current tab to set focus to the next field you want to visit. Even if it is on a different tab-page, Access will find it and put the focus there (so long as the field is Enabled).
If you are moving from a field in the Parent recordset to a field in a Sub_Form on another tab, there are three options;
- Move to the sub-form control
- Move to a control within the sub-form
- Move to the Tab Page
The first option is the simplest, just setfocus to the sub-form. The preset Tab-Order within the sub-form will then take over.
If you want to move to a specific field within the subform then you need the second line in the example below. This assumes that PhonesCustomers is a sub-form in a tab-page listing the one-to-many contacts within a customer's organisation. First set focus to the sub-form then move the focus inside it to the control you want.
- Private Sub ExchangeRate_LostFocus()
-
Me!PhonesCustomers.SetFocus
-
Me!PhonesCustomers.Form!PhoneNumber.SetFocus
-
End Sub
-
The third option does much the same as the first. The tab-control has a name of its own (I have one called TabCtl72) and each tab has a Page number starting from 0 (zero). You might need to use this option in a
Read-Only situation, where none of the controls in the sub-form will accept focus.
- Private Sub ExchangeRate_LostFocus()
-
Me.TabCtl72.Pages(2).SetFocus
-
End Sub
-
The next problem is when you are in one sub-form and want to move the focus to another field in another sub-form. Here you have to issue three seperate commands, first to move up to the Parent form from within the first sub-form. Then to move focus to the next sub-form; and finally to a specific field.
- Private Sub PhoneNumber_LostFocus()
-
Me.Parent.SetFocus
-
Me.Parent!NextSubform.SetFocus
-
Me.Parent!NextSubform.Form!NextField.SetFocus
-
End Sub
-
Note that all three commands are directed via the Parent form.
S7