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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Focus on Access Form

Status
Not open for further replies.

paullem

Programmer
Jan 21, 2005
80
GB
Hi,

Does anyone know how you find which control has focus on a Access 2003 form. I'm sure I've done this before but can't find the code.

Thanks
 
Will look forward to the guru's answer on this cos my thinking is:

Code:
dim ctl as control
set ctl = me.activecontrol

but of course, the conrol that triggers this event will have focus so it's kinda pointless!

Perhaps something like that on key down event? I don't have Access on this machine to test....

JB
 
That idea works if you set it in the OnTimer event but that's about all I just had someone check. Why would you want to do this? I'm sure there's a better way to achieve your result


JB
 
apologies for my bum steer, an idea that actually works if you chuck it on a button:

Code:
Dim ctl As Control
Set ctl = Screen.PreviousControl

MsgBox ctl.Name

JB
 
Hi, thanks for your reply JB.

What I'm trying to do is validate form fields using their Lost Focus events but not validate when the Exit Form command button has been clicked if you see what I mean.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top