Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    6

    Unanswered: Multiple if statements stop working?

    I have a form that is set up to connect and save to an excel spreadsheet. The form is setup up for 3 drivers. The issue I'm having is it wont get passed my Shift 1 set of if statements. Here is my code.

    'Shift1--------------------------------------------
    If Me.cmbShifts = "WED -1" And Not IsNull(Me.drName1) And Me.Check88 = False Then
    Response = MsgBox("Did " & Me.drName1 & " get a bank?", vbYesNo, Me.drName1 & " Bank?")
    Me.drName1.Enabled = True
    Me.totalSaleb1.Enabled = True
    Me.netSaleb1.Enabled = True
    Me.creditCardb1.Enabled = True
    Me.dmr1.Enabled = True
    Me.cashDue1.Enabled = True
    If Response = vbYes Then
    Excel.Range("b16").Formula = "=b11-b13+(b14*'Statement of Gross Sales'!$H$14)-b15+20"
    Excel.Range("b10") = (Me.drName1)
    Excel.Range("b11") = (Me.totalSaleb1)
    Excel.Range("b12") = (Me.netSaleb1)
    Excel.Range("b15") = (Me.creditCardb1)
    Me.dmr1 = Excel.Range("b13")
    Me.cashDue1 = Excel.Range("b16")
    Me.Check88 = -1
    Me.drName1.Enabled = False
    Me.totalSaleb1.Enabled = False
    Me.netSaleb1.Enabled = False
    Me.creditCardb1.Enabled = False
    Me.dmr1.Enabled = False
    Me.cashDue1.Enabled = False
    Else
    Excel.Range("b16").Formula = "=b11-b13+(b14*'Statement of Gross Sales'!$H$14)-b15"
    Excel.Range("b10") = (Me.drName1)
    Excel.Range("b11") = (Me.totalSaleb1)
    Excel.Range("b12") = (Me.netSaleb1)
    Excel.Range("b15") = (Me.creditCardb1)
    Me.dmr1 = Excel.Range("b13")
    Me.cashDue1 = Excel.Range("b16")
    Me.Check88 = -1
    Me.drName1.Enabled = False
    Me.totalSaleb1.Enabled = False
    Me.netSaleb1.Enabled = False
    Me.creditCardb1.Enabled = False
    Me.dmr1.Enabled = False
    Me.cashDue1.Enabled = False
    End If
    End If

    If Not IsNull(Me.drName2) And Me.Check100 = False Then
    Response = MsgBox("Did " & Me.drName2 & " get a bank?", vbYesNo, Me.drName2 & " Bank?")
    Me.drName2.Enabled = True
    Me.totalSales2.Enabled = True
    Me.netSales2.Enabled = True
    Me.creditCards2.Enabled = True
    Me.dmr2.Enabled = True
    Me.cashDue2.Enabled = True
    If Response = vbYes Then
    Excel.Range("c16").Formula = "=c11-c13+(c14*'Statement of Gross Sales'!$H$14)-c15+20"
    Excel.Range("c10") = (Me.drName2)
    Excel.Range("c11") = (Me.totalSales2)
    Excel.Range("c12") = (Me.netSales2)
    Excel.Range("c15") = (Me.creditCards2)
    Me.cashDue2 = Excel.Range("c16")
    Me.dmr2 = Excel.Range("c13")
    Me.Check100 = -1
    Me.drName2.Enabled = False
    Me.totalSales2.Enabled = False
    Me.netSales2.Enabled = False
    Me.creditCards2.Enabled = False
    Me.dmr2.Enabled = False
    Me.cashDue2.Enabled = False
    Else
    Excel.Range("c16").Formula = "=c11-c13+(c14*'Statement of Gross Sales'!$H$14)-c15"
    Excel.Range("c10") = (Me.drName2)
    Excel.Range("c11") = (Me.totalSales2)
    Excel.Range("c12") = (Me.netSales2)
    Excel.Range("c15") = (Me.creditCards2)
    Me.cashDue2 = Excel.Range("c16")
    Me.Check100 = -1
    Me.drName2.Enabled = False
    Me.totalSales2.Enabled = False
    Me.netSales2.Enabled = False
    Me.creditCards2.Enabled = False
    Me.dmr2.Enabled = False
    Me.cashDue2.Enabled = False
    End If
    End If

    If Not IsNull(Me.drName3) And Me.Check102.Value = False Then
    Response = MsgBox("Did " & Me.drName3 & " get a bank?", vbYesNo, Me.drName3 & " Bank?")
    Me.drName3.Enabled = True
    Me.totalSales3.Enabled = True
    Me.netSales3.Enabled = True
    Me.creditCards3.Enabled = True
    Me.dmr3.Enabled = True
    Me.cashDue3.Enabled = True
    If Response = vbYes Then
    Excel.Range("d16").Formula = "=d11-d13+(d14*'Statement of Gross Sales'!$H$14)-d15+20"
    Excel.Range("d10") = (Me.drName3)
    Excel.Range("d11") = (Me.totalSales3)
    Excel.Range("d12") = (Me.netSales3)
    Excel.Range("d15") = (Me.creditCards3)
    Me.cashDue3 = Excel.Range("d16")
    Me.dmr3 = Excel.Range("d13")
    Me.Check102 = -1
    Me.drName3.Enabled = False
    Me.totalSales3.Enabled = False
    Me.netSales3.Enabled = False
    Me.creditCards3.Enabled = False
    Me.dmr3.Enabled = False
    Me.cashDue3.Enabled = False
    Else
    Excel.Range("d16").Formula = "=d11-d13+(d14*'Statement of Gross Sales'!$H$14)-d15"
    Excel.Range("d10") = (Me.drName3)
    Excel.Range("d11") = (Me.totalSales3)
    Excel.Range("d12") = (Me.netSales3)
    Excel.Range("d15") = (Me.creditCards3)
    Me.cashDue3 = Excel.Range("d16")
    Me.Check102 = -1
    Me.drName3.Enabled = False
    Me.totalSales3.Enabled = False
    Me.netSales3.Enabled = False
    Me.creditCards3.Enabled = False
    Me.dmr3.Enabled = False
    Me.cashDue3.Enabled = False

    End If
    End If

    'Shift2--------------------------------------------

    If Me.cmbShifts = "WED -2" And Not IsNull(Me.drName1) And Me.Check88 = False Then
    Me.drName1.Enabled = True
    Me.totalSales1.Enabled = True
    Me.netSales1.Enabled = True
    Me.creditCards1.Enabled = True
    Me.dmr1.Enabled = True
    Me.cashDue1.Enabled = True
    Response = MsgBox("Did " & Me.drName1 & " get a bank?", vbYesNo, Me.drName1 & " Bank?")
    If Response = vbYes Then
    Excel.Range("s16").Formula = "=s11-s13+(s14*'Statement of Gross Sales'!$H$14)-s15+20"
    Excel.Range("s10") = (Me.drName1)
    Excel.Range("s11") = (Me.totalSales1)
    Excel.Range("s12") = (Me.netSales1)
    Excel.Range("s15") = (Me.creditCards1)
    Me.dmr1 = Excel.Range("s13")
    Me.cashDue1 = Excel.Range("s16")
    Me.Check88 = -1
    Me.drName1.Enabled = False
    Me.totalSales1.Enabled = False
    Me.netSales1.Enabled = False
    Me.creditCards1.Enabled = False
    Me.dmr1.Enabled = False
    Me.cashDue1.Enabled = False
    Else
    Excel.Range("s16").Formula = "=s11-s13+(s14*'Statement of Gross Sales'!$H$14)-s15"
    Excel.Range("s10") = (Me.drName1)
    Excel.Range("s11") = (Me.totalSales1)
    Excel.Range("s12") = (Me.netSales1)
    Excel.Range("s15") = (Me.creditCards1)
    Me.dmr1 = Excel.Range("s13")
    Me.cashDue1 = Excel.Range("s16")
    Me.Check88 = -1
    Me.drName1.Enabled = False
    Me.totalSales1.Enabled = False
    Me.netSales1.Enabled = False
    Me.creditCards1.Enabled = False
    Me.dmr1.Enabled = False
    Me.cashDue1.Enabled = False
    End If
    End If

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Not sure to understand. What do you mean with "it wont get passed my Shift 1 set of if statements" ?
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •