If Statements Not Progressing Through

reberryjr

Well-known Member
Joined
Mar 16, 2017
Messages
714
Office Version
  1. 365
Platform
  1. Windows
Can someone tell me why the first code snippet won't progress through? When I click No on the message box from the first if statement, the code isn't progressing through to the next if statement.

Code:
Private Sub cmd_Submit_Click()
Dim cGender, cEntryType, cPymtFreq, cPymtStatus, cStatus, cPymtMethod, cRefCat, cFacilitator, cPymtReason, cBiosClientID, cBiosNickname, cStatsClientID As Range
Dim ws1, ws2, ws3, ws4, ws5, ws6, ws7 As Worksheet
Dim Verify As Integer
Dim Response As VbMsgBoxResult
Dim IsOk As Boolean
    IsOk = True
Set ws1 = ThisWorkbook.Sheets("Management")
Set ws2 = ThisWorkbook.Sheets("Summaries")
Set ws3 = ThisWorkbook.Sheets("Bios")
Set ws4 = ThisWorkbook.Sheets("Stats")
Set ws5 = ThisWorkbook.Sheets("Pymt Tracker")
Set ws6 = ThisWorkbook.Sheets("Financials")
Set ws7 = ThisWorkbook.Sheets("Variables")
LastRow2 = ws2.Range("C" & Rows.Count).End(xlUp).Row
LastRow3 = ws3.Range("E" & Rows.Count).End(xlUp).Row
LastRow4 = ws4.Range("C" & Rows.Count).End(xlUp).Row
LastRow5 = ws5.Range("C" & Rows.Count).End(xlUp).Row
LastRow6 = ws6.Range("D" & Rows.Count).End(xlUp).Row
LastRow7 = ws7.Range("J" & Rows.Count).End(xlUp).Row
If Len(Me.txt_DPDate.Value) = 0 And Len(Me.txt_DPAmt.Value) = 0 And Len(Me.txt_DPPaid.Value) = 0 Then
    Verify = MsgBox("Did the Client sign up for a DP?", vbYesNo)
    If Response = vbYes Then Me.txt_DPDate.SetFocus
Exit Sub
End If
If (Not Len(Me.txt_CTIStart.Value) = 0 Or Not Len(Me.txt_CTI1stPymt.Value) = 0 Or (Me.txt_CTIPymtAmt.Value) > 0 Or Not Len(Me.cobo_CTIFreq.Value) = 0 Or _
    (Me.txt_CTIAmtPaid.Value) > 0) And (Len(Me.txt_CTIStart.Value) = 0 Or Len(Me.txt_CTI1stPymt.Value) = 0 Or Len(Me.txt_CTIPymtAmt.Value) = 0 Or Len(Me.cobo_CTIFreq.Value) = 0) Then
        MsgBox "Please complete the partial information in the CT-I section."
        If Response = vbOK Then Me.txt_CTIStart.SetFocus
Exit Sub
End If

When I use select case for other validations, it steps through as desired.
Code:
Select Case True
Case Me.txt_Notes = ""
    MsgBox "Please enter pertinent notes about the Client."
    If Response = vbOK Then Me.txt_Notes.SetFocus
    Exit Sub
    IsOk = False
Case Me.cobo_TotalPymtMethod = ""
    MsgBox "Please select the method the Client used to tender funds."
    If Response = vbOK Then Me.cobo_TotalPymtMethod.SetFocus
    Exit Sub
    IsOk = False
End Select
 
Yeah, that's how I normally handle the msgbox, but that's how the code was set up, that I found on the web.
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,224,827
Messages
6,181,199
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top