C
CAM
I am attaching some code that I have been using in a form that has been
working for a while. However, I just went to add some updates to it, and
discovered that it will no longer compile. I am using AccessXP. It stops at
the line
Case "CHUM SALMON", "PINK SALMON", "SOCKEYE SALMON"
and gives me the message 'compile error, case without select case' Does
this have something to do with having three cases on this one line-do I have
to seperate them out? Code follows. All help, is greatly appreciate. cam
PS. It did wrap some lines when I pasted them in. Those ones are on same
line in original code. Thanks again.
Public Function Update_AgeClassByLength()
Select Case [Common Name]
Case "CHINOOK SALMON"
If ([Month] = 5 And [Length] <= 120) Then
[Age_ClassByLength] = "subyearling"
ElseIf (([Month] = 6 Or [Month] = 7) And [Length] <=
140) Then
[Age_ClassByLength] = "subyearling"
ElseIf (([Month] = 8) And [Length] <= 215) Then
[Age_ClassByLength] = "subyearling"
ElseIf (([Month] = 9 Or [Month] = 10) And [Length] <=
250) Then
[Age_ClassByLength] = "subyearling"
ElseIf (([Month] = 11) And [Length] <= 280) Then
[Age_ClassByLength] = "subyearling"
ElseIf ([Month] = 5 And ([Length] > 120 And [Length] <=
250)) Then
[Age_ClassByLength] = "yearling"
ElseIf (([Month] = 6 Or [Month] = 7) And ([Length] > 140
Or [Length] <= 280)) Then
[Age_ClassByLength] = "yearling"
ElseIf ([Month] = 8 And ([Length] > 215 And [Length] <=
350)) Then
[Age_ClassByLength] = "yearling"
ElseIf (([Month] = 9 Or [Month] = 10) And ([Length] >
251 Or [Length] <= 400)) Then
[Age_ClassByLength] = "yearling"
ElseIf (([Month] = 11) And ([Length] > 281 Or [Length]
<= 400)) Then
[Age_ClassByLength] = "yearling"
ElseIf ([Month] = 5 And [Length] > 250) Then
[Age_ClassByLength] = "subadult/adult"
ElseIf (([Month] = 6 Or [Month] = 7) And [Length] > 280)
Then
[Age_ClassByLength] = "subadult/adult"
ElseIf ([Month] = 8 And [Length] > 350) Then
[Age_ClassByLength] = "subadult/adult"
ElseIf (([Month] = 9 Or [Month] = 10 Or [Month] = 11)
And [Length] > 400) Then
[Age_ClassByLength] = "subadult/adult"
End If
Case "COHO SALMON"
If ([Month] = 5 And [Length] <= 275) Then
[Age_ClassByLength] = "yearling"
ElseIf (([Month] = 6 Or [Month] = 7) And [Length] <=
330) Then
[Age_ClassByLength] = "yearling"
If ([Month] = 8 And [Length] <= 425) Then
[Age_ClassByLength] = "yearling"
ElseIf (([Month] = 9 Or [Month] = 10 Or [Month] = 11)
And [Length] <= 450) Then
[Age_ClassByLength] = "yearling"
ElseIf ([Month] = 5 And [Length] > 275) Then
[Age_ClassByLength] = "subadult/adult"
ElseIf (([Month] = 6 Or [Month] = 7) And [Length] > 330)
Then
[Age_ClassByLength] = "subadult/adult"
ElseIf ([Month] = 8 And [Length] > 425) Then
[Age_ClassByLength] = "subadult/adult"
ElseIf (([Month] = 9 Or [Month] = 10 Or [Month] = 11)
And [Length] > 450) Then
[Age_ClassByLength] = "subadult/adult"
End If
Case "CHUM SALMON", "PINK SALMON", "SOCKEYE SALMON"
If [Length] <= 350 Then
[Age_ClassByLength] = "juvenile"
ElseIf [Length] > 350 Then
[Age_ClassByLength] = "subadult/adult"
End If
Case "STEELHEAD"
If (([Month] = 5 Or [Month] = 6 Or [Month] = 7) And
[Length] <= 350) Then
[Age_ClassByLength] = "juvenile"
ElseIf (([Month] = 8 Or [Month] = 9 Or [Month] = 10 Or
[Month] = 11) And [Length] <= 400) Then
[Age_ClassByLength] = "juvenile"
ElseIf (([Month] = 5 Or [Month] = 6 Or [Month] = 7) And
[Length] > 350) Then
[Age_ClassByLength] = "subadult/adult"
ElseIf (([Month] = 8 Or [Month] = 9 Or [Month] = 10 Or
[Month] = 11) And [Length] > 400) Then
[Age_ClassByLength] = "subadult/adult"
End If
Case "CUTTHROAT TROUT"
[Age_ClassByLength] = "Total"
Case Else
[Age_ClassByLength] = Null
End Select
End Function
working for a while. However, I just went to add some updates to it, and
discovered that it will no longer compile. I am using AccessXP. It stops at
the line
Case "CHUM SALMON", "PINK SALMON", "SOCKEYE SALMON"
and gives me the message 'compile error, case without select case' Does
this have something to do with having three cases on this one line-do I have
to seperate them out? Code follows. All help, is greatly appreciate. cam
PS. It did wrap some lines when I pasted them in. Those ones are on same
line in original code. Thanks again.
Public Function Update_AgeClassByLength()
Select Case [Common Name]
Case "CHINOOK SALMON"
If ([Month] = 5 And [Length] <= 120) Then
[Age_ClassByLength] = "subyearling"
ElseIf (([Month] = 6 Or [Month] = 7) And [Length] <=
140) Then
[Age_ClassByLength] = "subyearling"
ElseIf (([Month] = 8) And [Length] <= 215) Then
[Age_ClassByLength] = "subyearling"
ElseIf (([Month] = 9 Or [Month] = 10) And [Length] <=
250) Then
[Age_ClassByLength] = "subyearling"
ElseIf (([Month] = 11) And [Length] <= 280) Then
[Age_ClassByLength] = "subyearling"
ElseIf ([Month] = 5 And ([Length] > 120 And [Length] <=
250)) Then
[Age_ClassByLength] = "yearling"
ElseIf (([Month] = 6 Or [Month] = 7) And ([Length] > 140
Or [Length] <= 280)) Then
[Age_ClassByLength] = "yearling"
ElseIf ([Month] = 8 And ([Length] > 215 And [Length] <=
350)) Then
[Age_ClassByLength] = "yearling"
ElseIf (([Month] = 9 Or [Month] = 10) And ([Length] >
251 Or [Length] <= 400)) Then
[Age_ClassByLength] = "yearling"
ElseIf (([Month] = 11) And ([Length] > 281 Or [Length]
<= 400)) Then
[Age_ClassByLength] = "yearling"
ElseIf ([Month] = 5 And [Length] > 250) Then
[Age_ClassByLength] = "subadult/adult"
ElseIf (([Month] = 6 Or [Month] = 7) And [Length] > 280)
Then
[Age_ClassByLength] = "subadult/adult"
ElseIf ([Month] = 8 And [Length] > 350) Then
[Age_ClassByLength] = "subadult/adult"
ElseIf (([Month] = 9 Or [Month] = 10 Or [Month] = 11)
And [Length] > 400) Then
[Age_ClassByLength] = "subadult/adult"
End If
Case "COHO SALMON"
If ([Month] = 5 And [Length] <= 275) Then
[Age_ClassByLength] = "yearling"
ElseIf (([Month] = 6 Or [Month] = 7) And [Length] <=
330) Then
[Age_ClassByLength] = "yearling"
If ([Month] = 8 And [Length] <= 425) Then
[Age_ClassByLength] = "yearling"
ElseIf (([Month] = 9 Or [Month] = 10 Or [Month] = 11)
And [Length] <= 450) Then
[Age_ClassByLength] = "yearling"
ElseIf ([Month] = 5 And [Length] > 275) Then
[Age_ClassByLength] = "subadult/adult"
ElseIf (([Month] = 6 Or [Month] = 7) And [Length] > 330)
Then
[Age_ClassByLength] = "subadult/adult"
ElseIf ([Month] = 8 And [Length] > 425) Then
[Age_ClassByLength] = "subadult/adult"
ElseIf (([Month] = 9 Or [Month] = 10 Or [Month] = 11)
And [Length] > 450) Then
[Age_ClassByLength] = "subadult/adult"
End If
Case "CHUM SALMON", "PINK SALMON", "SOCKEYE SALMON"
If [Length] <= 350 Then
[Age_ClassByLength] = "juvenile"
ElseIf [Length] > 350 Then
[Age_ClassByLength] = "subadult/adult"
End If
Case "STEELHEAD"
If (([Month] = 5 Or [Month] = 6 Or [Month] = 7) And
[Length] <= 350) Then
[Age_ClassByLength] = "juvenile"
ElseIf (([Month] = 8 Or [Month] = 9 Or [Month] = 10 Or
[Month] = 11) And [Length] <= 400) Then
[Age_ClassByLength] = "juvenile"
ElseIf (([Month] = 5 Or [Month] = 6 Or [Month] = 7) And
[Length] > 350) Then
[Age_ClassByLength] = "subadult/adult"
ElseIf (([Month] = 8 Or [Month] = 9 Or [Month] = 10 Or
[Month] = 11) And [Length] > 400) Then
[Age_ClassByLength] = "subadult/adult"
End If
Case "CUTTHROAT TROUT"
[Age_ClassByLength] = "Total"
Case Else
[Age_ClassByLength] = Null
End Select
End Function