[AccessD] Data type mismatch in function

Kaup, Chester Chester_Kaup at kindermorgan.com
Wed Dec 5 10:54:16 CST 2012


I am calling the following function from a query. I get a type mismatch error at the first record. Value of status is "PA".  I don't understand the mismatch. Thanks.

Here is the SQL.  dbo_DSS_StatusChanges is an SQL server table with status as a data type of text

SELECT PID, WellStatus(Status) AS ReturnStatus
FROM dbo_DSS_StatusChanges;

Here is the function:

Public Function WellStatus(Status As String) As String

Select Case Status
    Case "FL" Or "FM" Or "FH", "PL" Or "PM" Or "PH" Or "SL" Or "SM" Or "SH" Or "SP" Or "RL" Or "RM" Or "RH" Or "RP"
        ReturnStatus = "PRD"
    Case "CI" Or "WAGC"
        ReturnStatus = "GasI"
    Case "WD" Or "WI" Or "WC" Or "WCH" Or "WF"
        ReturnStatus = "WI"
    Case Else
        ReturnStatus = ""
End Select

WellStatus = ReturnStatus

End Function


More information about the AccessD mailing list