Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set focus to a subform

Status
Not open for further replies.

ancb

Programmer
Aug 7, 2003
42
0
0
US
Does anyone know how to set the focus to a subform by simply moving the mouse over it (not clicking in any of it's controls)?
 
I have not tried it and I maybe wrong, but I guess this will not be possible unless the subform is the current active form.

If the parent form is active then there will be no events triggered on the subform.

Once the subform has the focus or is activated then its possible you can do this for the period the subform is active.

Passingby
 
I put a box around the subform and set the mouse move property and I get an error.


My code was:

sfLoadPlanning.setfocus
_______________________

The error said :

Run-time error '2449':

There is an invalid method in an expression.
____________________________________________

 
Error code 2449 refers
ErrorString
There is an invalid method in an expression.@For example, you may have tried to use the Print method with an object other than Report or Debug.@@2@2015551@1

Doesn't tell you much really!

I am using A97 and there does not appear to be any Event for Mouse Over for any of the control types.

As before, I'm not convinced it can be done but would also be interested if anyone comes up with the goods!

PassingBy
 
For anyone interested I got this to work. I put a regular box around the subform and used the following code:

Private Sub bxLoadPlanningFocus_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim ctlCurrentControl As Control

Set ctlCurrentControl = Screen.ActiveControl

If ctlCurrentControl = "sfLoadList" Then
sfAvailDrv.SetFocus
Else
sfLoadList.SetFocus
End If
End Sub

Now when I move the mouse over the box frame int sets focus to the subform. This is a contiuous form and to scroll through the record I had to click in the form which had the potential to change data.

anyway, later

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top