R
Risky Dave
Hi,
Can someone please explain why this isn't working? I am trying to capture
two values entered into a form by a user - Cost Score and Cost Estimate. Cost
Score is a value of 1 - 5 and Cost Estimate is a value in £'s. Each of the 5
possible Cost Scores has a range of Cost Estimates that is valid for it and
this code is trying to check that an appropriate Estimate has been made
against the declared Score. If an appropriate Estimate has not been made, an
error message is returned.
When this runs with legitimate values entered in TextBoxes 16 and 17, it
still returns the error message and I don't understand why so any
observations would be much appreciated.
Sub BAUCostCheck()
Dim lCostScore As Long ' used to capture the assessed cost score
Dim lCostEst As Long ' used to capture the estimated cost
lCostScore = CLng(FmRiskCost.TextBox16.Value)
lCostEst = CLng(FmRiskCost.TextBox17.Value)
Select Case True
Case lCostScore = "1"
<do stuff>
Case lCostScore = "2"
<do stuff>
Case lCostScore = "3"
If lCostEst > 50000 and lCostEst < 100000 Then
MsgBox "Medium cost must be between £50,000 and £100,000",
vbExclamation, "Cost Estimation Error"
FmRiskCost.TextBox19.Value = ""
FmRiskCost.TextBox22.Value = ""
FmRiskCost.TextBox24.Value = ""
FmRiskCost.TextBox25.Value = ""
FmRiskCost.TextBox26.Value = ""
End If
Case lCostScore ="4"
Can someone please explain why this isn't working? I am trying to capture
two values entered into a form by a user - Cost Score and Cost Estimate. Cost
Score is a value of 1 - 5 and Cost Estimate is a value in £'s. Each of the 5
possible Cost Scores has a range of Cost Estimates that is valid for it and
this code is trying to check that an appropriate Estimate has been made
against the declared Score. If an appropriate Estimate has not been made, an
error message is returned.
When this runs with legitimate values entered in TextBoxes 16 and 17, it
still returns the error message and I don't understand why so any
observations would be much appreciated.
Sub BAUCostCheck()
Dim lCostScore As Long ' used to capture the assessed cost score
Dim lCostEst As Long ' used to capture the estimated cost
lCostScore = CLng(FmRiskCost.TextBox16.Value)
lCostEst = CLng(FmRiskCost.TextBox17.Value)
Select Case True
Case lCostScore = "1"
<do stuff>
Case lCostScore = "2"
<do stuff>
Case lCostScore = "3"
If lCostEst > 50000 and lCostEst < 100000 Then
MsgBox "Medium cost must be between £50,000 and £100,000",
vbExclamation, "Cost Estimation Error"
FmRiskCost.TextBox19.Value = ""
FmRiskCost.TextBox22.Value = ""
FmRiskCost.TextBox24.Value = ""
FmRiskCost.TextBox25.Value = ""
FmRiskCost.TextBox26.Value = ""
End If
Case lCostScore ="4"