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!

Determine If a Contol Has Focus

Status
Not open for further replies.

mtwildtrout

Technical User
Oct 1, 2003
23
0
0
US
Is there a way to determine if a control has focus from VB code? I need to determine if a command button has focus so I can trigger some additional code. I would envision the code to be placed in the Before Update or Close event.

Also, is there a way to know if the user has clicked the "X" close window button on a form?
 
see the help file for "ActiveControl"

e.g. (within a form)
if me.activecontrol.name = "cmdButton" then
....
end if


if no control has focus then an error will occur

Cheers,
Dan
 
Dan,

Thanks for putting me in the right direction!

Don
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top