current form and control

J

John Spencer

Code snippet follows.

Dim v As Object
Set v = Screen.ActiveControl
Debug.Print v.Name, v.Parent.Name
Debug.Print Screen.ActiveForm.Name, Screen.ActiveForm.Caption

Beyond that it is hard to say since you didn't say where you wanted to run
the code. In a form event you can get the form name with Me.Name and the
current control with Me.ActiveControl.

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
A

alekm

Thanx,
I'd like to run it from Event procedure.
One more question: how do I determine value Me.ActiveControl has?

alek_mil
 
D

Douglas J. Steele

Value is usually the default property, so simply referring to
Screen.ActiveControl should give the its value. If not, try
Screen.ActiveControl.Value
 

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