[AccessD] Data type mismatch in function

jwcolby jwcolby at colbyconsulting.com
Wed Dec 5 11:05:04 CST 2012


I don't see return status dimensioned in the function.  If it isn't dimensioned then it will be 
dynamically dimensioned as type variant which may be causing an issue somehow.

John W. Colby
Colby Consulting

Reality is what refuses to go away
when you do not believe in it

On 12/5/2012 11:54 AM, Kaup, Chester wrote:
> 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