Why am I getting these compiler errors?

Getting these error:

TimeEntry.TimerStoped, line 11
Type mismatch error. Expected Integer, but got Boolean
Select case lnMinutes

TimeEntry.TimerStoped, line 16
Syntax error
Case (lnMinutes => 7 and lnMinutes < 22)

TimeEntry.TimerStoped, line 19
Syntax error
Case lnMinutes >= 22 and lnMinutes < 37

TimeEntry.TimerStoped, line 11
Type mismatch error. Expected Integer, but got Boolean
Select case lnMinutes

Dim ldTime As DateInterval
Var lnMinutes, lnHours As Integer

ldTime = mWatch.Elapsed

lnMinutes = 6 'ldTime.Minutes

lnHours = 1 'ldTime.Hours


Select case lnMinutes
  
Case lnMinutes < 7
  lnMinutes = 0
  
Case (lnMinutes >= 7 and lnMinutes < 22)
  lnMinutes = 25
  
Case lnMinutes >= 22 and lnMinutes < 37
  lnMinutes = 50
  
Case (lnMinutes >= 37 and lnMinutes < 52)
  lnMinutes = 75
  
else
  lnMinutes = 0
  lnHours = lnHours + 1
end

txtHours.text = lnHours.ToText + "." + lnMinutes.ToText

I’ve done this hundreds of times.

Thanks

You’re missing the “IS” keyword here, e.g., Case Is < 7, or you have to make the SELECT condition “true”, e.g., Select Case True.

1 Like

Just made an update

Here’s example from help:

Var dayNumber As Integer
Var msg As String
dayNumber = Val(TextField1.Value)

Select Case dayNumber
Case 2
  msg = "It's Monday"
Case 3
  msg = "It's Tuesday"
Case 4
  msg = "It's Wednesday"
Case 5
  msg = "It's Thursday"
Case 6
  msg = "It's Friday"
Else
  msg = "It's the weekend."
End Select

MessageBox(msg)

That example is correct, and is different than the code you posted in the way I described above.

In your code:

Select case lnMinutes //integer
Case lnMinutes < 7 //boolean

example code

Select Case dayNumber //integer
Case 2 //integer
1 Like

Got it,

Going to try

Thanks all

Not there yet:

Select case True
  
Case is (lnMinutes < 7)
  lnMinutes = 0
  
Case is (lnMinutes >= 7 and lnMinutes < 22)
  lnMinutes = 25
  

Now getting TimeEntry.TimerStoped, line 13
Syntax error
Case is (lnMinutes < 7)

TimeEntry.TimerStoped, line 16
Syntax error
Case is (lnMinutes >= 7 and lnMinutes < 22)

Got it, remove the is

Thanks

2 Likes