Lost My Focus

G

Guest

I would like the lost focus event of a combo box to execute. However, because
some of the commands are about the combo box, I can not do them while the
focus is there. And I can't move the focus while the combo box has it. A real
Catch-22. So I was wondering if there is a way to issue a "tab" command just
as if the user hits the tab key on the keyboard? When I try this on the form
everything works fine. So in the after update event I would like to put a
"tab" command, any ideas? Thanks.
 
G

Guest

What commands are you trying to execute in the Lost Focus event? That may
not be the correct place to do them. Can you post the code in the the event?
To "tab" to the next control, use the SetFocus method:

Me.NameOfControl.Setfocus

But, I would like to see your code before you do this. The Set Focus event
is not usually where you put code. There are times to use it, but it is rare.
 
G

Guest

Klatuu:
I left a little of the story out. I have a text box called Full and a combo
box underneath it called Flip. In Full the name is Mickey Mouse, in Flip,
Mouse, Mickey. I do this so you can look people up by last name but have
their name properly displayed all the other times. The get focus of the Full
unhides the Flip, sets the focus there, and hides the Full. Now in the Flip
combo, after the update, I want to make the Full visible, set the focus to
it, and set the Flip invisible so the name appears in proper order. It fails
when I try to set the focus after the update so I tried to switch the field's
visible options on the lost focus event. This also failed telling me that I
can't hide a box while it has the focus. So my original question was how to
perform a tab, which would move the focus off the Flip box and cause the lost
focus to fire. And thats the whole enchilada.

Private Sub MemberFull_GotFocus()
With Forms(Meform)
.MemberFlip.Visible = True
.MemberFlip.SetFocus <-- This works
.MemberFull.Visible = False
End With
End Sub

Private Sub MemberFlip_AfterUpdate()
With Forms(Meform)
.MemberFull.Visible = True
.MemberFull.SetFocus <-- This fails
.MemberFlip.Visible = False
End With
End Sub

Private Sub MemberFlip_LostFocus()
With Forms(Meform)
.MemberFlip.Visible = False <-- This fails, still
has focus
.MemberFull.Visible = True
End With
End Sub
 

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