| (Q) How can I get handle to a control at runtime? (A) Access controls are not standard VB controls.  They're drawn on the screen at
runtime. As such, unlike VB controls, they do not have a unique hWnd.     When an Access control on a form receives the focus, it becomes a
true window and it's possible to retrieve it's handle by using the GetFocus API.  
Note that because Access controls do not behave like VB controls, there's not a whole lot
that we can do with the hWnd. 
Private Declare Function apiGetFocus Lib "user32" _
        Alias "GetFocus" _
         () As Long
         
Function fhWnd(ctl As Control) As Long
    On Error Resume Next
    ctl.SetFocus
    If Err Then
        fhWnd = 0
    Else
        fhWnd = apiGetFocus
    End If
    On Error GoTo 0
End Function
 |