By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,952 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

Referring to controls in Modules

P: n/a
PMB
Thank you in advance for any and all assistance. It is greatly appreciated.

I was wondering how do you refer to controls in a Module, in a private or public function?

I've tried Me.ActiveControl and get errors.

Michael
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
PMB wrote:
Thank you in advance for any and all assistance. It is greatly
appreciated. I was wondering how do you refer to controls in a Module,
in a private or public function? I've tried Me.ActiveControl and get
errors. Michael


Code from MSAccess97 help
Sub ActiveObjects()
Dim frm As Form, ctl As Control

' Return Form object pointing to active form.
Set frm = Screen.ActiveForm
MsgBox frm.Name & " is the active form."
' Return Control object pointing to active control.
Set ctl = Screen.ActiveControl
MsgBox ctl.Name & " is the active control " _
& "on this form."
End Sub

You can also pass the control or form to the module
PassIt Me, Me.Text0

Function PassIt(frm As From, txb As TextBox) or
Function PassIt(frm As From, ctl As Control)
Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.