How to change tab page with OnCurrent Property

  • Thread starter Thread starter DOYLE60
  • Start date Start date
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
 
try to get active control name using screen.activecontrol, then execute your
code, then set focus to back to control
 
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.
 
Back
Top