TextBox Focus

  • Thread starter Thread starter John Wilson
  • Start date Start date
J

John Wilson

Wondering if this is possible (it's giving me an error).

On a UserForm
I have Frame1 with TextBox1 in it.
I have Frame2 with TextBox2 in it.

How can I set focus to TextBox2 in the AfterUpdate event for TextBox1??
Frame2.TextBox2.SetFocus ' doesn't work
TextBox2.SetFocus ' doesn't work

Setting the Tab order doesn't work either.

Any ideas??

Thanks,
John
 
frame1 - tabindex 0
frame2 - tabindex 1

within each frame, the textboxes had tabindex 0

for me, hitting enter in textbox1 (frame1) put the focus in the textbox in
frame2

Regards,
Tom Ogilvy
 
Tom,

Tried that and it didn't work :-(
I'll play around wit it again tomorrow and see if I can
come up with something else.
The easy way out would be to place both TextBoxes in the
same Frame but I shoudn't "have" to do that.

Thanks,
John
 
Tom,
No you shouldn't,
You're right. I tried what you suggested in a brand new workboook
with a brand new userform and it worked as you said it would.
so there must be more involved than what you describe
Obviously something in my coding or whatever on that UserForm.
I'll go back and try to find out where my mistake is.

Thanks,
John
 
Tom,

In the Textbox1 After_Update event, I had the following code:
TextBox2.Enabled = True

Removing that line of code cured my woes.

Thanks,
John
 
Tom,

Neglected to mention in that last post that I had TextBox2 disabled in
the UserForm Activate event (you probably already figured that out).
I would venture to guess that Excel tries to tab to TextBox2
before the code in the the TextBox1.After_Update event can enable it.

Thanks,
John
 
Back
Top