Results 1 to 4 of 4
  1. #1
    KelleyM is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    9

    Mystery Mismatch in Data Type

    I've got a frustrating little problem I was hoping to get some help with. I have querry that I want to select either



    1. all of an individuals claims if we have never asked for reimbursement or
    2. just the claims paid since the begining of the month otherwise.

    Here is the query with the critria like I want them.

    Code:
    SELECT tblAllClaims.*, [Adj Worksheet qryDB1.zip].RNAME, tblAllClaims.Paiddt
    FROM [Adj Worksheet qry] INNER JOIN tblAllClaims ON ([Adj Worksheet qry].REINS_YEAR = tblAllClaims.RYEAR) AND ([Adj Worksheet qry].MEMBER = tblAllClaims.MEMID) AND ([Adj Worksheet qry].CONVERTED_CONTRACT = tblAllClaims.CONVERTED_CONTRACT)
    WHERE ((([Adj Worksheet qry].SumOfCarrierPaid)>=[Stoploss] And ([Adj Worksheet qry].SumOfCarrierPaid) Is Null) AND (([ShockTotal]-Nz([SumOfCarrierPaid]))<>0)) OR ((([ShockTotal]-Nz([SumOfCarrierPaid]))<>0) AND (([Adj Worksheet qry].ShockTotal)>=[Stoploss]) AND ((tblAllClaims.Paiddt)>=20120801)) OR ((([Adj Worksheet qry].SumOfCarrierPaid)>=[Stoploss] And ([Adj Worksheet qry].SumOfCarrierPaid) Is Null) AND (([ShockTotal]-Nz([SumOfCarrierPaid]))<>0)) OR ((([ShockTotal]-Nz([SumOfCarrierPaid]))<>0) AND (([Adj Worksheet qry].ShockTotal)>=[Stoploss]) AND ((tblAllClaims.Paiddt)>=20120801));
    This triggers a datatype mismatch error.

    So, I tried to narrow down what was triggering that error.

    This, with no criteria on PAIDDT, ran fine.

    Code:
    SELECT tblAllClaims.*, [Adj Worksheet qry].RNAME
    FROM [Adj Worksheet qry] INNER JOIN tblAllClaims ON ([Adj Worksheet qry].REINS_YEAR = tblAllClaims.RYEAR) AND ([Adj Worksheet qry].MEMBER = tblAllClaims.MEMID) AND ([Adj Worksheet qry].CONVERTED_CONTRACT = tblAllClaims.CONVERTED_CONTRACT)
    WHERE ((([ShockTotal]-Nz([SumOfCarrierPaid]))<>0) AND (([Adj Worksheet qry].SumOfCarrierPaid)>=[Stoploss] And ([Adj Worksheet qry].SumOfCarrierPaid) Is Null)) OR ((([ShockTotal]-Nz([SumOfCarrierPaid]))<>0) AND (([Adj Worksheet qry].ShockTotal)>=[Stoploss])) OR ((([ShockTotal]-Nz([SumOfCarrierPaid]))<>0) AND (([Adj Worksheet qry].SumOfCarrierPaid)>=[Stoploss] And ([Adj Worksheet qry].SumOfCarrierPaid) Is Null)) OR ((([ShockTotal]-Nz([SumOfCarrierPaid]))<>0) AND (([Adj Worksheet qry].ShockTotal)>=[Stoploss]));
    So, I think PAIDDT must be the problem. But this, with just the criteria on PAIDDT, also runs fine.

    Code:
    SELECT tblAllClaims.*, [Adj Worksheet qry].RNAME, tblAllClaims.PAIDDT
    FROM [Adj Worksheet qry] INNER JOIN tblAllClaims ON ([Adj Worksheet qry].REINS_YEAR = tblAllClaims.RYEAR) AND ([Adj Worksheet qry].MEMBER = tblAllClaims.MEMID) AND ([Adj Worksheet qry].CONVERTED_CONTRACT = tblAllClaims.CONVERTED_CONTRACT)
    WHERE (((tblAllClaims.PAIDDT)>=20120801));
    To add to the general confusion. I made a clean db with just the table structures and relevent querries (DB1.zip) and my querry works fine in there.

    AH!

    I have no idea what is going on. Please help!
    Last edited by KelleyM; 09-11-2012 at 10:25 AM. Reason: db not attached

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    My first guess would be the criteria is not delimited correctly. In your WHERE clause you have
    WHERE (((tblAllClaims.PAIDDT)>=20120801));

    What is the field type of "PAIDDT"?
    If it is a Date/Time type, it needs to be delimited with hash marks (#).
    If it is a Text type, it needs to be delimited with quotes.


    It looks like 20120801 is yyyymmdd (ie 08/01/2012), so I would guess that the field is a text type.

  3. #3
    KelleyM is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    9
    PAIDDT is actually not a Data/Time type. It is a number type double.

    I was trying to explain, the PAIDDT critiria works by itself but not when combined with the critiria for the Adj Worksheet query.

    Thank you for the response.

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    OK,

    I re-arranged your query for ease of reading and it looks like you have duplicated the criteria in the WHERE clause. (or Access did ).

    Code:
    SELECT tblAllClaims.*, [Adj Worksheet qryDB1.zip].RNAME, tblAllClaims.Paiddt
    
    FROM 
    [Adj Worksheet qry] INNER JOIN tblAllClaims ON 
        ([Adj Worksheet qry].REINS_YEAR = tblAllClaims.RYEAR) 
    AND ([Adj Worksheet qry].MEMBER = tblAllClaims.MEMID) 
    AND ([Adj Worksheet qry].CONVERTED_CONTRACT = tblAllClaims.CONVERTED_CONTRACT)
    
    WHERE 
       ((([Adj Worksheet qry].SumOfCarrierPaid)>=[Stoploss] And ([Adj Worksheet qry].SumOfCarrierPaid) Is Null) AND (([ShockTotal]-Nz([SumOfCarrierPaid]))<>0))
    OR ((([Adj Worksheet qry].SumOfCarrierPaid)>=[Stoploss] And ([Adj Worksheet qry].SumOfCarrierPaid) Is Null) AND (([ShockTotal]-Nz([SumOfCarrierPaid]))<>0)) 
    
    OR ((([ShockTotal]-Nz([SumOfCarrierPaid]))<>0) AND (([Adj Worksheet qry].ShockTotal)>=[Stoploss]) AND ((tblAllClaims.Paiddt)>=20120801)) 
    OR ((([ShockTotal]-Nz([SumOfCarrierPaid]))<>0) AND (([Adj Worksheet qry].ShockTotal)>=[Stoploss]) AND ((tblAllClaims.Paiddt)>=20120801));

    Any-hoo, I would start out with the basic select
    Code:
    SELECT tblAllClaims.*, [Adj Worksheet qryDB1.zip].RNAME, tblAllClaims.Paiddt
    
    FROM 
    [Adj Worksheet qry] INNER JOIN tblAllClaims ON 
        ([Adj Worksheet qry].REINS_YEAR = tblAllClaims.RYEAR) 
    AND ([Adj Worksheet qry].MEMBER = tblAllClaims.MEMID) 
    AND ([Adj Worksheet qry].CONVERTED_CONTRACT = tblAllClaims.CONVERTED_CONTRACT)
    then start adding in the criteria one at a time until you get the error.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Data type mismatch error
    By Tomfernandez1 in forum Programming
    Replies: 5
    Last Post: 10-05-2012, 07:27 AM
  2. Data type mismatch error
    By nigelbloomy in forum Programming
    Replies: 1
    Last Post: 08-01-2012, 09:19 AM
  3. Data Type Mismatch in SQL
    By Phred in forum Queries
    Replies: 2
    Last Post: 01-04-2012, 03:40 PM
  4. Data Type Mismatch
    By timmy in forum Programming
    Replies: 9
    Last Post: 04-12-2011, 03:48 AM
  5. data type mismatch
    By jgelpi16 in forum Programming
    Replies: 5
    Last Post: 08-02-2010, 04:15 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums