How to set focus to control outside of frame

N

news.rcn.com

I have a user form with text boxes within a frame and a button outside the
frame. In the _AfterUpdate() handler for the text boxes, I want to set
focus to the button. When I try this, is get a "unexpected call to method
or property access" error.

If I move the button into the frame SetFocus works.
If I try to set the caption of the button when it is outside the frame, it
works.

Can anyone explain what's happening here? and how to do the set focus?

Also, I only want the frame to group the edits; I don't want it to have any
functional impact. Is there another way to achieve this?

If it makes any difference, this is in the visual basic editor in Word.

I thank you for your help.

Jim Cant
 
P

Perry

Check the tabindices of the frame and the commandbutton.
If you want the commandbutton to receive focus after controls in the frame
are validated, set it's tabindex one higher than the frame's tabindex
number.

The controls in a frame-control are situated in a container (the frame)
where as the frame itself is a control to the userform container.
So if you want to implement a logical taborder (input procedure), this is
something you'll have to reckon with.
Same goes for multipage controls.

Krgrds,
Perry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top