I have the following code and am using the really looking at the "mgrCheck"/"ownCheck" variables for my question. I put these in to assist with my Select Case statement.
My Select Case is meant to display 3 different msgbox's, depending on the combination of variables:
I don't think I'm calling these variables correctly in the Case statements, because when I click my associated form button, nothing happens. The problem is, I've never done something like this before and cannot identify where the problem lies.
Code:
If DCount("*", "Table1") > 0 Then
totalAcct = DCount("*", "Table1")
mgrDeny = DCount("*", "Table1", "[APPROVE/DENY] Like 'Deny'")
mgrTotal = DCount("*", "Table1", "Completed = 'Yes'")
mgrPer = (mgrTotal / totalAcct)
mgrCheck = 1
Else
mgrPer = 0
mgrDeny = 0
mgrCheck = 0
End If
If DCount("*", "Table2") > 0 Then
totalAcct = DCount("*", "Table2")
ownDeny = DCount("*", "Table2", "[APPROVE/DENY] Like 'Deny'")
ownTotal = DCount("*", "Table2", "Completed = 'Yes'")
ownPer = (ownTotal / totalAcct)
ownCheck = 1
Else
ownPer = 0
ownDeny = 0
ownCheck = 0
End If
My Select Case is meant to display 3 different msgbox's, depending on the combination of variables:
Code:
Select Case mgrCheck
Case (mgrCheck = 1) And (ownCheck = 0)
MsgBox "# of Accounts Denied by Manager: " & Space(22) & mgrDeny & vbNewLine & _
"# of Accounts Denied by Owner: " & Space(26) & ownDeny & vbNewLine & _
"Total Completion Percentage: " & Space(20) & FormatPercent(mgrPer / ((totalAcct) * 2)), vbInformation, "KPIs"
Case (mgrCheck = 1) And (ownCheck = 1)
MsgBox "# of Accounts Denied by Manager: " & Space(22) & mgrDeny & vbNewLine & _
"# of Accounts Denied by Owner: " & Space(26) & ownDeny & vbNewLine & _
"Total Completion Percentage: " & Space(20) & FormatPercent((mgrPer + ownPer) / 2), vbInformation, "KPIs"
Case (mgrCheck = 0) And (ownCheck = 0)
MsgBox "# of Accounts Denied by Manager: " & Space(22) & mgrDeny & vbNewLine & _
"# of Accounts Denied by Owner: " & Space(26) & ownDeny & vbNewLine & _
"Total Completion Percentage: " & Space(20) & FormatPercent(0), vbInformation, "KPIs"
End Select
I don't think I'm calling these variables correctly in the Case statements, because when I click my associated form button, nothing happens. The problem is, I've never done something like this before and cannot identify where the problem lies.