I've created 2 fSort modules in a query to pull 2 different fields from a table and assign a unique name to each. Both modules look identical syntax-wise.
This one works perfectly:
Option Compare Database
Option Explicit
Public Function fSort1(district As String)
Select Case district
Case "NC", "SC"
fSort1 = "NCSC"
Case "TN/KY - E", "TN/KY - W"
fSort1 = "TNKY"
Case "FL - N", "FL - S"
fSort1 = "FL"
Case "AL", "MS", "LA"
fSort1 = "ALMSLA"
Case "GA - Out", "GA - Atl"
fSort1 = "GA"
End Select
End Function
This one stops after the first record:
Option Compare Database
Option Explicit
Public Function fSort(ospcm As String)
Select Case ospcm
Case "NC EAST", "NC WEST"
fSort = "NC"
Case "SOUTH CAROLINA"
fSort = "SC"
Case "Georgia Atlanta"
fSort = "GA - Atl"
Case "GEORGIA OUTSTATE"
fSort = "GA - Out"
Case "ALABAMA FL', FL NOrth"
fSort = "FL - N"
Case "FL South"
fSort = "FL - S"
Case "ALABAMA"
fSort = "AL"
Case "MISSISSIPPI"
fSort = "MS"
Case "LOUISIANA"
fSort = "LA"
Case "kentucky e", "tn east"
fSort = "TN/KY - E"
Case "kentucky w", "tn west"
fSort = "TN/KY - W"
End Select
End Function
Thanks in advance,
Steve1