There's no HasFocus property, but the form has an ActiveControl property
that returns an object reference to the control on the form (if any)
that currently has the focus. So you could write a function like this:
'----- start of code -----
Function HasFocus( _
ctl As Access.Control, _
frm As Access.Form) _
As Boolean
On Error Resume Next
If ctl Is frm.ActiveControl Then
HasFocus = True
End If
End Function
'----- end of code -----
And use it like this:
If HasFocus(Me.Text1, Me) Then
' Text1 has the focus.
End If
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)