How to change tab page with OnCurrent Property

D

DOYLE60

I am able to change the page on a tab to match some current information for
each record using the following code:

If DivisionNumber = 888 Then
Me!Tab1 = 1
Else
Me!Tab1 = 0
End If

But it also puts the focus on the first object on that page. I would like the
focus to stay where it is instead of changing. What is the code I need to add
to do that?

Thanks,

Matt
 
A

Alex Dybenko

try to get active control name using screen.activecontrol, then execute your
code, then set focus to back to control
 
J

John Spencer (MVP)

Is the control that has the focus before switching the tab page on a tab page or
is it on the form that has the tab control? If the former, then there is really
no way to keep the focus on the original control. The control is now "hidden"
and therefore can't keep the focus.

Otherwise, you could try saving the name of the original control, switching the
tab page, and then resetting the focus to the original control.
 

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