Hi all I wonder if some one can help me please.
I am working on a userform on this form there are 10 frames all hidden until a number is inputted into a textbox so if textbox = 4 then 4 frames become visible, within these frames are textboxes and what the code below is doing is checking these boxes for values if they are empty it lets you know that some of the boxes are empty, this is all working fine on all frames, except I would like it to only check the visible frames and this is where I am having issues, cant seem to get the code right on this, all frames return the false msgbox even if they are visible and therefore don't check the textboxes in the frames. hope someone can help.
thanks.
Dim SB As Control
Dim SBVAL As String
Dim SFR As MSFORMS.Control
For Each SFR In REPAIR_QUOTE_FORM.MultiPage1.Pages(4).Controls
If TypeName(SFR) = "Frame" Then
If SFR.Controls.Visible = False Then
MSGVALUE = MsgBox(SFR.Name, vbOK, "false") only here to help in debugging
GoTo nextframe
ElseIf SFR.Controls.Visible = True Then
MSGVALUE = MsgBox(SFR.Name, vbOK, "TRUE")only here to help in debugging
For Each SB In SFR.Controls
If TypeName(SB) = "textbox" Then
SBVAL = SB.Value
If SBVAL = "" Then
MSGVALUE = MsgBox("SERVICE DETAIL MISSING ?" _
& vbCr & "IS THIS CORRECT?:" _
& vbCr & "NO: FOR SERVICE PAGE:" _
& vbCr & "YES: TO CONTINUE:" _
, vbYesNo + vbQuestion, "ME")
If MSGVALUE = vbNo Then
REPAIR_QUOTE_FORM.MultiPage1.Value = 1
REPAIR_QUOTE_FORM.MultiPage1.Pages(4).SB1.SetFocus
Exit Sub
ElseIf MSGVALUE = vbYes Then GoTo loopstart
End If
End If
End If
Next SB
End If
End If
nextframe:
Next SFR
loopstart:
MsgBox "END"only here to help in debugging
End Sub
I am working on a userform on this form there are 10 frames all hidden until a number is inputted into a textbox so if textbox = 4 then 4 frames become visible, within these frames are textboxes and what the code below is doing is checking these boxes for values if they are empty it lets you know that some of the boxes are empty, this is all working fine on all frames, except I would like it to only check the visible frames and this is where I am having issues, cant seem to get the code right on this, all frames return the false msgbox even if they are visible and therefore don't check the textboxes in the frames. hope someone can help.
thanks.
Dim SB As Control
Dim SBVAL As String
Dim SFR As MSFORMS.Control
For Each SFR In REPAIR_QUOTE_FORM.MultiPage1.Pages(4).Controls
If TypeName(SFR) = "Frame" Then
If SFR.Controls.Visible = False Then
MSGVALUE = MsgBox(SFR.Name, vbOK, "false") only here to help in debugging
GoTo nextframe
ElseIf SFR.Controls.Visible = True Then
MSGVALUE = MsgBox(SFR.Name, vbOK, "TRUE")only here to help in debugging
For Each SB In SFR.Controls
If TypeName(SB) = "textbox" Then
SBVAL = SB.Value
If SBVAL = "" Then
MSGVALUE = MsgBox("SERVICE DETAIL MISSING ?" _
& vbCr & "IS THIS CORRECT?:" _
& vbCr & "NO: FOR SERVICE PAGE:" _
& vbCr & "YES: TO CONTINUE:" _
, vbYesNo + vbQuestion, "ME")
If MSGVALUE = vbNo Then
REPAIR_QUOTE_FORM.MultiPage1.Value = 1
REPAIR_QUOTE_FORM.MultiPage1.Pages(4).SB1.SetFocus
Exit Sub
ElseIf MSGVALUE = vbYes Then GoTo loopstart
End If
End If
End If
Next SB
End If
End If
nextframe:
Next SFR
loopstart:
MsgBox "END"only here to help in debugging
End Sub