N
New_Access
I had following module :
'=====================================
Option Compare Database
Option Explicit
Sub ToggleVisibility(VisibilityStatus As Boolean)
Dim ctlCurr As Control
'focus is set to a control
' that will always be visible before running the loop.
[Specification input_frm].SpeedMode_opt.SetFocus
For Each ctlCurr In [Specification input_frm].Controls
If ctlCurr.Tag = "GroupStep2" Then
ctlCurr.Visible = VisibilityStatus
End If
Next ctlCurr
End Sub
'*****************************************
And then have following code :
==================================
Private Sub SpeedMode_opt_AfterUpdate()
'This code for hide or shown
'fields of speed step 2 specification
On Error GoTo Err_SpeedMode_opt_AfterUpdate
Dim booVisibility As Boolean
booVisibility = Not Me.SpeedMode_opt
Call ToggleVisibility(booVisibility)
End_SpeedMode_opt_AfterUpdate:
Exit Sub
Err_SpeedMode_opt_AfterUpdate:
MsgBox Err.Description & "(" & Err.Number & ") in " & _
Me.Name & ".SpeedMode_opt_AfterUpdate", _
vbOKOnly + vbCritical, "Error Occured"
Resume End_SpeedMode_opt_AfterUpdate
'*****************************************
But then there is an error message
"Object required in Specification input_frm.SpeedMode_opt_AfterUpdate"
And loop doesn't happen.Why?What's wrong? Please help me rid on this.
'=====================================
Option Compare Database
Option Explicit
Sub ToggleVisibility(VisibilityStatus As Boolean)
Dim ctlCurr As Control
'focus is set to a control
' that will always be visible before running the loop.
[Specification input_frm].SpeedMode_opt.SetFocus
For Each ctlCurr In [Specification input_frm].Controls
If ctlCurr.Tag = "GroupStep2" Then
ctlCurr.Visible = VisibilityStatus
End If
Next ctlCurr
End Sub
'*****************************************
And then have following code :
==================================
Private Sub SpeedMode_opt_AfterUpdate()
'This code for hide or shown
'fields of speed step 2 specification
On Error GoTo Err_SpeedMode_opt_AfterUpdate
Dim booVisibility As Boolean
booVisibility = Not Me.SpeedMode_opt
Call ToggleVisibility(booVisibility)
End_SpeedMode_opt_AfterUpdate:
Exit Sub
Err_SpeedMode_opt_AfterUpdate:
MsgBox Err.Description & "(" & Err.Number & ") in " & _
Me.Name & ".SpeedMode_opt_AfterUpdate", _
vbOKOnly + vbCritical, "Error Occured"
Resume End_SpeedMode_opt_AfterUpdate
'*****************************************
But then there is an error message
"Object required in Specification input_frm.SpeedMode_opt_AfterUpdate"
And loop doesn't happen.Why?What's wrong? Please help me rid on this.