RE: Problem with SetFocus
- From: MikeJohnB <MikeJohnB@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 26 Feb 2007 15:48:08 -0800
If that works, I have an idea why
Regards Mike B
--
An Engineers Prayer:
At the very end of the day,
when all else fails,
you have tried all,
you have shouted at and blamed the innocent,
and asked everyone you know,
READ THE INSTRUCTION MANUAL.
"MikeJohnB" wrote:
Just a thought, have you tried setting focus to the form first as:.
Forms!NameAndAddress.SetFocus
Forms!NameAndAddress.Repaint
Forms!NameAndAddress.SetFocus
Forms!NameAndAddress![Post Code].SetFocus
I dont get an error when I use the last two lines but I don't use the
repaint method.
I have noticed I have used DoCmd to overcome one issue the same as yours
DoCmd.SetWarnings False
DoCmd.GoToControl "ProjectPlan"
DoCmd.SetWarnings True
I can't remember why I used this though and most of the time,
Forms!FormName.SetFocus
Forms!FormName![Post Code].SetFocus
Appears to work for me?? Let know if you find the error?
Mike B
--
An Engineers Prayer:
At the very end of the day,
when all else fails,
you have tried all,
you have shouted at and blamed the innocent,
and asked everyone you know,
READ THE INSTRUCTION MANUAL.
"OssieMac" wrote:
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
- References:
- RE: Problem with SetFocus
- From: MikeJohnB
- RE: Problem with SetFocus
- Prev by Date: Re: import a range in a column to an access table
- Next by Date: Re: Date() function
- Previous by thread: RE: Problem with SetFocus
- Next by thread: Re: Problem with SetFocus
- Index(es):
Relevant Pages
|