Which field has focus

M

Michel Walsh

Hi,


Control. A Form owns controls, a Table owns fields. Those are two different
things. It may occur that both have the same name, but a field in a table
exists even without any form displaying it and an unbound control has no ...
field ... to relate to.

Screen.ActiveControl could help to get the control with the focus ( but you
cannot easily debug step by step over such a statement, on the other hand,
since the control would loose it focus to the window with the code being
debugged in step by step mode).



Hoping it may help,
Vanderghast, Access MVP
 
M

Marshall Barton

Shane said:
How do you determine which field has the focus on a form in VB.


In the same form as the code:
Me.ActiveControl
or, it the code in not in the same form as the control:
Forms!nameof form.ActiveControl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top