[AccessD] Data type mismatch in function

David McAfee davidmcafee at gmail.com
Wed Dec 5 13:12:25 CST 2012


I just created a little database with a simple table and it works
using this function:

Public Function WellStatus(Status As String) As String
Dim ReturnStatus As String
 Select Case Status
    Case "FL", "FM", "FH", "PL", "PM", "PH", "SL", "SM", "SH", "SP",
"RL", "RM", "RH", "RP"
        ReturnStatus = "PRD"
    Case "CI", "WAGC"
        ReturnStatus = "GasI"
    Case "WD", "WI", "WC", "WCH", "WF"
        ReturnStatus = "WI"
    Case Else
        ReturnStatus = ""
 End Select
 WellStatus = ReturnStatus
End Function


Here's the test query:
SELECT StatusChange.ID, StatusChange.Status, WellStatus([Status]) AS
ReturnStatus
FROM StatusChange;

and the results:

Query1
ID Status ReturnStatus
1 FL PRD
2 FM PRD
3 FL PRD
4 FH PRD
5 PL PRD
6 PM PRD
7 LA
8 PH PRD
9 SL PRD
10 PA
11 CI GasI
12 WD WI
13 WI WI
14 NV



On Wed, Dec 5, 2012 at 11:03 AM, David McAfee <davidmcafee at gmail.com> wrote:
>
> Did you replace every Or in the function with a comma?
>
>


More information about the AccessD mailing list