Link to home
Start Free TrialLog in
Avatar of burtfaceman
burtfacemanFlag for Canada

asked on

TextBox disappears behind OLE object control

An Access 2007 database has a form with 6 tabs; tab 6 in this form has an OLE object control and a TextBox control; the TextBox control is in front of the OLE object control; the OnCurrent event in the form uses the move method to move the TextBox control. The previously active control must remain active when the OnCurrent event fires.

Problem: When any tab other than tab 6 is active and the OnCurrent event fires, the TextBox disappears behind the OLE object (which can be seen when you go back to tab 6); the TextBox must remain in front of the OLE object.

Unsuccessful solutions:
-docmd.runcommand bringtofront - can not be run unless form is in design view, apparently.
-Tried ctrl = activecontrol, TextBox.SetFocus, ctrl.setfocus in the OnCurrent event; have not been able to set a variable as activecontrol. I have tried many different little variations of this, but none have been able to grab activecontrol.
Avatar of puppydogbuddy
puppydogbuddy

Here is how you grab the active control......code from the tips page of www.aadconsulting.com

The ActiveControl object does not have a Name property, so you need to use the Control object class:

Function GetActiveCtlName() As String
__Dim ctlCurrentControl As Control
__Set ctlCurrentControl = Screen.ActiveControl
__GetActiveCtlName = ctlCurrentControl.Name
End Function


ASKER CERTIFIED SOLUTION
Avatar of burtfaceman
burtfaceman
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial