G
Guest
I am using Access 2002. I have considerable experience with Excel and VBA but
very little with Access.
My problem is with SetFocus. I have a main form and a subform. I shift the
focus to the subform and after some processing I am trying to set the focus
back to a control on the main form. However, I get an error 2110. (Microsoft
Access can’t move the focus to this control.)
After considerable testing, the SetFocus appeared to be working even though
I was still getting the error message.
I tried OnError Resume Next to suppress the Error message and now it works
fine. However, I would like to know if anyone can give me any advice. Perhaps
I should be including some other code first.
This is the code. (I have tried with and without the first 3 lines and they
make no difference.)
Forms!NameAndAddress.Visible = True
Forms!NameAndAddress.SetFocus
Forms!NameAndAddress.Repaint
On Error Resume Next
Forms!NameAndAddress![Post Code].SetFocus
On Error GoTo 0
Have also tried the following without success using both with and without
the error message suppressing. Doesn’t work with either method.
Forms!NameAndAddress.Visible = True
Forms!NameAndAddress.SetFocus
Forms!NameAndAddress.Repaint
DoCmd.GoToControl [Post Code]
Will very much appreciate any help.
Regards,
OssieMac
very little with Access.
My problem is with SetFocus. I have a main form and a subform. I shift the
focus to the subform and after some processing I am trying to set the focus
back to a control on the main form. However, I get an error 2110. (Microsoft
Access can’t move the focus to this control.)
After considerable testing, the SetFocus appeared to be working even though
I was still getting the error message.
I tried OnError Resume Next to suppress the Error message and now it works
fine. However, I would like to know if anyone can give me any advice. Perhaps
I should be including some other code first.
This is the code. (I have tried with and without the first 3 lines and they
make no difference.)
Forms!NameAndAddress.Visible = True
Forms!NameAndAddress.SetFocus
Forms!NameAndAddress.Repaint
On Error Resume Next
Forms!NameAndAddress![Post Code].SetFocus
On Error GoTo 0
Have also tried the following without success using both with and without
the error message suppressing. Doesn’t work with either method.
Forms!NameAndAddress.Visible = True
Forms!NameAndAddress.SetFocus
Forms!NameAndAddress.Repaint
DoCmd.GoToControl [Post Code]
Will very much appreciate any help.
Regards,
OssieMac