Can't get my Focus

D

Dave

I have a form(frmProducts) on a tab control object (TabClt) that is on
another form(frmOrders).
I have a search box on frmProducts that filters "On change" and then keeps
its focus in that box.

Private Sub txtDescSearch_Change()
DoCmd.ShowAllRecords
Me.Filter = "Description like '" & txtDescSearch & "*'"
Me.FilterOn = True
Me.txtDescSearch.SetFocus
SendKeys "{F2}"
End Sub

It works fine when I open frmProducts by itself but when I open the tab it
is on from frmOrders.
When I enter the first search letter it does filter but the focus goes to
the tab label.
I tried changing
Me.txtDescSearch.SetFocus
To
Forms!frmProducts! txtDescSearch.SetFocus
But that did not seem to help either.

What am I doing wrong here?


Thanks in advance
D
 
G

Guest

Hi Dave

Set the focus to the subform (Tab) 1st, then (after) set the focus to the
control

abcSubForm.Setfocus
xyzControl.Setfocus

Hope this helps
 
D

Dave

Thanks Wayne,
I made several attempts at what you suggested with no luck

I keep getting an error trying any of these to get the focus back on the
subforn first.

frmProducts.Forms!.SetFocus

Forms!.frmProducts.SetFocus

frmProducts.Form!txtCodeSearch.SetFocus

Any suggestions what I am doing wrong there?
D
 

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