[AccessD] Data type mismatch in function

Kaup, Chester Chester_Kaup at kindermorgan.com
Wed Dec 5 11:14:36 CST 2012


I noticed that right after posting. Unfortunately that did not fix the problem.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Wednesday, December 05, 2012 11:05 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Data type mismatch in function

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
>

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list