K
Kirk P.
I can't figure this out. Here's my code:
Public Function E1Sgmt(E1ProdCode As String)
Select Case E1ProdCode
Case "001", "004-02"
E1Sgmt = "CN"
Case "002", "004-01", "004-05", "008", "009", "998"
E1Sgmt = "CPP"
Case "003", "004-06"
E1Sgmt = "EQUIP"
Case "004-03", "004-04", "006", "007", "990"
E1Sgmt = "RS"
Case "005"
E1Sgmt = "RN"
Case "010", "991"
E1Sgmt = "ADMIN"
Case "011", "996"
E1Sgmt = "OTHER"
Case Else
E1Sgmt = "Unclassified"
End Select
End Function
Everything works fine except for the "004-01" through "004-06" portions.
They are returning "Unclassified" instead of their respective values. The
real baffler is, when I use the Immediate window and supply the text value of
"004-01", it returns the correct answer, in this case "CPP", however when I
use the function in an update query, and supply the argument, it returns
"Unclassified". E1 Prod Cd is a text field in tblFinData. Here's my update
SQL as well - any ideas?
UPDATE tblFinData SET [E1 Segment] = E1Sgmt([E1 Prod Cd]);
Public Function E1Sgmt(E1ProdCode As String)
Select Case E1ProdCode
Case "001", "004-02"
E1Sgmt = "CN"
Case "002", "004-01", "004-05", "008", "009", "998"
E1Sgmt = "CPP"
Case "003", "004-06"
E1Sgmt = "EQUIP"
Case "004-03", "004-04", "006", "007", "990"
E1Sgmt = "RS"
Case "005"
E1Sgmt = "RN"
Case "010", "991"
E1Sgmt = "ADMIN"
Case "011", "996"
E1Sgmt = "OTHER"
Case Else
E1Sgmt = "Unclassified"
End Select
End Function
Everything works fine except for the "004-01" through "004-06" portions.
They are returning "Unclassified" instead of their respective values. The
real baffler is, when I use the Immediate window and supply the text value of
"004-01", it returns the correct answer, in this case "CPP", however when I
use the function in an update query, and supply the argument, it returns
"Unclassified". E1 Prod Cd is a text field in tblFinData. Here's my update
SQL as well - any ideas?
UPDATE tblFinData SET [E1 Segment] = E1Sgmt([E1 Prod Cd]);