latex88
Registered User.
- Local time
- Today, 10:10
- Joined
- Jul 10, 2003
- Messages
- 198
So, I think I have a good routine to make all controls of a form invisible except a few, but I'm getting "You entered an expression that requires a form to be the active window." I've put the below code in On Open, On Load, On Activate, and still get the error with this line being highlighted,
Please help. I actually would like to use this in other forms too. Do I just make a public function?Set frmCurrentForm = Screen.ActiveForm
Public Sub CloseAllControls()
Dim frmCurrentForm As Form
Set frmCurrentForm = Screen.ActiveForm
Dim ctl As Control
Dim CurrentForm As Form
Set CurrentForm = Screen.ActiveForm
For Each ctl In CurrentForm.Controls
ctl.Visible = False
Next ctl
End Sub