T
Tom
I need some help with modifying the FOR loop below.
This loop checks if any options groups have not been selected on the active
worksheet tab. If yes (some radio buttons have not been selected), it
brings focus to the option group control.
Now, here's what I want to do.
1. Instead of "just bringing focus" to the control, I also want to make a
small image visible.
2. I placed as many small images onto the form as I have options groups
(right now 21)... while 18 options groups
are currently "sitting" on Tab1, the remaining 3 options groups reside on
Tab2
3. The iamge control names are: "QuestionMark1", "QuestionMark2",
"QuestionMark3", ... "QuestionMark21"
***** BEGIN CURRENT FUNCTION ********************
Dim ctl As Control
For Each ctl In Me.TabControl1.Pages(TabControl1).Controls
' Check to see if control is text box.
If ctl.ControlType = acOptionGroup Then
If ctl.Enabled = True Then
If IsNull(ctl) Then 'If question unanswered
MsgBox "You must complete all questions on the survey.",
vbInformation, "Missing Data"
ctl.SetFocus 'Brings survey participant to the missing answer
Exit Sub 'Leave the routine
End If
End If
End If
Next ctl
***** END CURRENT FUNCTION ********************
I want the enviosioned function to be rewritten so that it loops through the
options groups and makes the image visible where option group is unanswered.
I added 2 lines into the function where I think images are made not
visible/visible: "<<< logical approach, but wrong syntax I guess"
***** BEGIN ENVISIONED FUNCTION ********************
Dim ctl As Control
For Each ctl In Me.TabControl1.Pages(TabControl1).Controls
Me.QuestionMark#.Visible = False <<< logical
approach, but wrong syntax I guess
' Check to see if control is text box.
If ctl.ControlType = acOptionGroup Then
If ctl.Enabled = True Then
If IsNull(ctl) Then 'If question unanswered
MsgBox "You must complete all questions on the survey.",
vbInformation, "Missing Data"
ctl.SetFocus 'Brings survey participant to the missing answer
Me.QuestionMark#.Visible = True <<< logical
approach, but wrong syntax I guess
Exit Sub 'Leave the routine
End If
End If
End If
Next ctl
***** END ENVISIONED FUNCTION ********************
Can anyone help me out rewrite this function?
Thanks,
Tom
This loop checks if any options groups have not been selected on the active
worksheet tab. If yes (some radio buttons have not been selected), it
brings focus to the option group control.
Now, here's what I want to do.
1. Instead of "just bringing focus" to the control, I also want to make a
small image visible.
2. I placed as many small images onto the form as I have options groups
(right now 21)... while 18 options groups
are currently "sitting" on Tab1, the remaining 3 options groups reside on
Tab2
3. The iamge control names are: "QuestionMark1", "QuestionMark2",
"QuestionMark3", ... "QuestionMark21"
***** BEGIN CURRENT FUNCTION ********************
Dim ctl As Control
For Each ctl In Me.TabControl1.Pages(TabControl1).Controls
' Check to see if control is text box.
If ctl.ControlType = acOptionGroup Then
If ctl.Enabled = True Then
If IsNull(ctl) Then 'If question unanswered
MsgBox "You must complete all questions on the survey.",
vbInformation, "Missing Data"
ctl.SetFocus 'Brings survey participant to the missing answer
Exit Sub 'Leave the routine
End If
End If
End If
Next ctl
***** END CURRENT FUNCTION ********************
I want the enviosioned function to be rewritten so that it loops through the
options groups and makes the image visible where option group is unanswered.
I added 2 lines into the function where I think images are made not
visible/visible: "<<< logical approach, but wrong syntax I guess"
***** BEGIN ENVISIONED FUNCTION ********************
Dim ctl As Control
For Each ctl In Me.TabControl1.Pages(TabControl1).Controls
Me.QuestionMark#.Visible = False <<< logical
approach, but wrong syntax I guess
' Check to see if control is text box.
If ctl.ControlType = acOptionGroup Then
If ctl.Enabled = True Then
If IsNull(ctl) Then 'If question unanswered
MsgBox "You must complete all questions on the survey.",
vbInformation, "Missing Data"
ctl.SetFocus 'Brings survey participant to the missing answer
Me.QuestionMark#.Visible = True <<< logical
approach, but wrong syntax I guess
Exit Sub 'Leave the routine
End If
End If
End If
Next ctl
***** END ENVISIONED FUNCTION ********************
Can anyone help me out rewrite this function?
Thanks,
Tom