A
Amit
MS Access 2k, Win XP
======================
Hi,
I have a main form with two sub-forms on it. The tab order
on the form is as follows:
-a control on the main form
-the first sub-form control (sfrmPerson)
-back to a control on the main form
-the second sub-form control (sfrmPersonPhone)
-back to a control on the main-form.
The way I'm accomplishing this (so that a user can use the
TAB key to move to the next control) is by adding unbound
textboxes to the main form and the sub-forms, and setting
the focus to the next control in their "Got Focus"
property.
I was having a difficulty in setting focus to the control
on the sub-form from the main-form, and Marshall Barton's
reply a few days ago fixed that (Thanks, Marshall). But,
now, I have a new problem:
run-time error 2110: Microsoft Access can't move the focus
to the control sfrmPersonPhone.
The funny thing is that I don't get this error when I set
focus to the first sub-form control. It happens when I try
to set focus to the second sub-form control.
Also, the TAB key works fine on the first record when I
open the form, but when I go to the second record (either
by using TAB or the recod navigation key), I get the run-
time error 2110.
Main form: frmQuestionnaire2
1st sub-form: sfrmPerson
2nd sub-form: sfrmPersonPhone
(I have the sub-form control name same as the sub-form
name)
Here's the code in frmQuestionnaire2:
==========================================================
Private Sub txtTabToDate_GotFocus()
'move focus to subform control sfrmPerson
Me!sfrmPerson.SetFocus
'move focus to the date field in the sub-form
Me!sfrmPerson.Form!SurveyCompletedDate.SetFocus
End Sub
------------------------------------------------------
Private Sub txtTabToPhone_GotFocus()
'move focus to subform control sfrmPersonPhone
Me!sfrmPersonPhone.SetFocus
'move focus to the phone field in the sub-form
Me!sfrmPersonPhone.Form!PersonPhone.SetFocus
End Sub
==========================================================
The code in the sub-forms:
[sfrmPerson]
==========================================================
Private Sub txtTabToOrgName_GotFocus()
'set focus to OrgName control in the main-form
Me.Parent!OrgName.SetFocus
End Sub
==========================================================
[sfrmPersonPhone]
==========================================================
Private Sub txtTabToOrgURL_GotFocus()
'set focus to OrgURL control in the main-form
Me.Parent!OrgURL.SetFocus
End Sub
==========================================================
The unbound textboxes are all visible and enabled. The
controls and the sub-forms are on a page of a TabControl
on the form. I've tested by placing the same controls and
sub-forms on a form without a TabControl, and get the same
error.
If you have any pointers or know how to fix this error,
and why it's happening, I'll appreciate that.
Thanks!
-Amit
======================
Hi,
I have a main form with two sub-forms on it. The tab order
on the form is as follows:
-a control on the main form
-the first sub-form control (sfrmPerson)
-back to a control on the main form
-the second sub-form control (sfrmPersonPhone)
-back to a control on the main-form.
The way I'm accomplishing this (so that a user can use the
TAB key to move to the next control) is by adding unbound
textboxes to the main form and the sub-forms, and setting
the focus to the next control in their "Got Focus"
property.
I was having a difficulty in setting focus to the control
on the sub-form from the main-form, and Marshall Barton's
reply a few days ago fixed that (Thanks, Marshall). But,
now, I have a new problem:
run-time error 2110: Microsoft Access can't move the focus
to the control sfrmPersonPhone.
The funny thing is that I don't get this error when I set
focus to the first sub-form control. It happens when I try
to set focus to the second sub-form control.
Also, the TAB key works fine on the first record when I
open the form, but when I go to the second record (either
by using TAB or the recod navigation key), I get the run-
time error 2110.
Main form: frmQuestionnaire2
1st sub-form: sfrmPerson
2nd sub-form: sfrmPersonPhone
(I have the sub-form control name same as the sub-form
name)
Here's the code in frmQuestionnaire2:
==========================================================
Private Sub txtTabToDate_GotFocus()
'move focus to subform control sfrmPerson
Me!sfrmPerson.SetFocus
'move focus to the date field in the sub-form
Me!sfrmPerson.Form!SurveyCompletedDate.SetFocus
End Sub
------------------------------------------------------
Private Sub txtTabToPhone_GotFocus()
'move focus to subform control sfrmPersonPhone
Me!sfrmPersonPhone.SetFocus
'move focus to the phone field in the sub-form
Me!sfrmPersonPhone.Form!PersonPhone.SetFocus
End Sub
==========================================================
The code in the sub-forms:
[sfrmPerson]
==========================================================
Private Sub txtTabToOrgName_GotFocus()
'set focus to OrgName control in the main-form
Me.Parent!OrgName.SetFocus
End Sub
==========================================================
[sfrmPersonPhone]
==========================================================
Private Sub txtTabToOrgURL_GotFocus()
'set focus to OrgURL control in the main-form
Me.Parent!OrgURL.SetFocus
End Sub
==========================================================
The unbound textboxes are all visible and enabled. The
controls and the sub-forms are on a page of a TabControl
on the form. I've tested by placing the same controls and
sub-forms on a form without a TabControl, and get the same
error.
If you have any pointers or know how to fix this error,
and why it's happening, I'll appreciate that.
Thanks!
-Amit