T
Tom
Hi:
I need some help with the function below (&&&s)... more specifically, I need
some help w/ the "If IsNull(Me.Frame5) Then" routine.
Here's what I have:
- form with tab control
- Next (and Previous) command button are in form footer
- each tab (page) has multiple option groups. Each group has 6 radio
buttons.
- Next_Click routine has For Loop that does do the following: 1) when Next
is clicked, checks if each option group has an "answer", 2) if any one
option group does not have an answer, it places an image (questionmark) next
to the question and gives user a "visual reminder" to complete the
unanswered question(s)
- this process worked great thus far
Now, I have made a "conceptual change" in respect to the options groups.
This change is such as:
- instead of answering all questions, a user may or may not answer all
question because of "question hierarchy".
- for instance, there might be a "parent question" which has "children
questions".
- if a parent question is answered with "No" (or radio button value "0"),
then children questions will be disabled and their values automatically
become "0" as well.
- however, if the parent question is answered with "Yes" (or radio button
value "5") then the user must complete all of the subordinate children
questions as well
- essentially something like this: "Do you work with customers"? (parent
question)... if "no" skip to question XYZ, if "yes" please complete the next
3 questions (children questions)...
Okay, here's now the problem w/ my ForLoop that has been working fine until
this conceptual change:
First though, let me say that I just added the 9 lines (IF ELSE statement)
for the "Me.Frame5".
Problem w/o the IF ELSE:
==================
- if I answered "no" and skipped e.g. 3 questions, I could not move to the
next page. Besides, the question mark image was placed next to the 3
unanswered questions (which were hidden)... so I had images "next to
nothing"
Problem w/ the IF Else:
================
- although the IF ELSE takes care of the ladder problem ("I can't move to
next page"), I must get the images if I do answer the parent question with
"Yes" (or radio button value "5"). BTW, parent question only have those 2
values (0 and 5... essentially parent questions are of boolean type... Yes
or No).
So, here's my question now: Why does the IF ELSE works fine as a
workaround for "No" answers, but it doesn't work for "Yes" questions... here
I'm missing my images (and I can move to then next page) even though those
questions must be answered and I should not move to the next page until
that's the case.
Thanks so much in advance,
Tom
P.S.... sorry for this long-winded problem...
&&&&&&&&&&&&&&&&&&&
Private Sub Next_Click()
Dim strSQL As String
Dim ctl As Control, strNL As String
strNL = ""
If IsNull(Me.Frame5) Then
Me.Frame6.Enabled = False
Me.Frame7.Enabled = False
Me.Frame8.Enabled = False
Else
Me.Frame6.Enabled = True
Me.Frame7.Enabled = True
Me.Frame8.Enabled = True
End If
For Each ctl In Me.TabControl1.Pages(TabControl1).Controls
'Checks to determine control is text box
If ctl.ControlType = acOptionGroup Then
If ctl.Enabled = True Then
If IsNull(ctl) Then 'If question is unanswered
strFrame = ctl.Name 'Determines the QuestionMark #
(image)
Debug.Print strFrame
strNL = strNL & strFrame & ","
intFr = Mid(strFrame, 6, Len(strFrame) - 5)
Me("QuestionMark" & intFr).Visible = True 'Makes
QuestionMark image visible
End If
End If
End If
Next ctl
If Len(strNL) > 0 Then
Dim ctrl As Control
strNL = Left(strNL, Len(strNL) - 1)
MsgBox "You must complete all questions on this page before you
can move to the next page.", vbInformation, "Missing Data"
If InStr(strNL, ",") > 0 Then
strFrame = Left(strNL, InStr(1, strNL, ",") - 1)
Else
strFrame = strNL
End If
Me(strFrame).SetFocus
Exit Sub
End If
End Sub
&&&&&&&&&&&&&&&&&&&
I need some help with the function below (&&&s)... more specifically, I need
some help w/ the "If IsNull(Me.Frame5) Then" routine.
Here's what I have:
- form with tab control
- Next (and Previous) command button are in form footer
- each tab (page) has multiple option groups. Each group has 6 radio
buttons.
- Next_Click routine has For Loop that does do the following: 1) when Next
is clicked, checks if each option group has an "answer", 2) if any one
option group does not have an answer, it places an image (questionmark) next
to the question and gives user a "visual reminder" to complete the
unanswered question(s)
- this process worked great thus far
Now, I have made a "conceptual change" in respect to the options groups.
This change is such as:
- instead of answering all questions, a user may or may not answer all
question because of "question hierarchy".
- for instance, there might be a "parent question" which has "children
questions".
- if a parent question is answered with "No" (or radio button value "0"),
then children questions will be disabled and their values automatically
become "0" as well.
- however, if the parent question is answered with "Yes" (or radio button
value "5") then the user must complete all of the subordinate children
questions as well
- essentially something like this: "Do you work with customers"? (parent
question)... if "no" skip to question XYZ, if "yes" please complete the next
3 questions (children questions)...
Okay, here's now the problem w/ my ForLoop that has been working fine until
this conceptual change:
First though, let me say that I just added the 9 lines (IF ELSE statement)
for the "Me.Frame5".
Problem w/o the IF ELSE:
==================
- if I answered "no" and skipped e.g. 3 questions, I could not move to the
next page. Besides, the question mark image was placed next to the 3
unanswered questions (which were hidden)... so I had images "next to
nothing"
Problem w/ the IF Else:
================
- although the IF ELSE takes care of the ladder problem ("I can't move to
next page"), I must get the images if I do answer the parent question with
"Yes" (or radio button value "5"). BTW, parent question only have those 2
values (0 and 5... essentially parent questions are of boolean type... Yes
or No).
So, here's my question now: Why does the IF ELSE works fine as a
workaround for "No" answers, but it doesn't work for "Yes" questions... here
I'm missing my images (and I can move to then next page) even though those
questions must be answered and I should not move to the next page until
that's the case.
Thanks so much in advance,
Tom
P.S.... sorry for this long-winded problem...
&&&&&&&&&&&&&&&&&&&
Private Sub Next_Click()
Dim strSQL As String
Dim ctl As Control, strNL As String
strNL = ""
If IsNull(Me.Frame5) Then
Me.Frame6.Enabled = False
Me.Frame7.Enabled = False
Me.Frame8.Enabled = False
Else
Me.Frame6.Enabled = True
Me.Frame7.Enabled = True
Me.Frame8.Enabled = True
End If
For Each ctl In Me.TabControl1.Pages(TabControl1).Controls
'Checks to determine control is text box
If ctl.ControlType = acOptionGroup Then
If ctl.Enabled = True Then
If IsNull(ctl) Then 'If question is unanswered
strFrame = ctl.Name 'Determines the QuestionMark #
(image)
Debug.Print strFrame
strNL = strNL & strFrame & ","
intFr = Mid(strFrame, 6, Len(strFrame) - 5)
Me("QuestionMark" & intFr).Visible = True 'Makes
QuestionMark image visible
End If
End If
End If
Next ctl
If Len(strNL) > 0 Then
Dim ctrl As Control
strNL = Left(strNL, Len(strNL) - 1)
MsgBox "You must complete all questions on this page before you
can move to the next page.", vbInformation, "Missing Data"
If InStr(strNL, ",") > 0 Then
strFrame = Left(strNL, InStr(1, strNL, ",") - 1)
Else
strFrame = strNL
End If
Me(strFrame).SetFocus
Exit Sub
End If
End Sub
&&&&&&&&&&&&&&&&&&&