Results 1 to 4 of 4
  1. #1
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262

    Data Type Mismatch in criteria expression

    I've seen posts on this error before, but none of them helped me solve my problem. Here's my SQL query code:



    Code:
    SELECT BOMSearch.[BOM Qty], BOMSearch.[BOM UOM], MinPrices.PartNumber, MinPrices.[MinOfUnit Price], MinPrices.MinBuy, MinPrices.MinBuyUOM, MinPrices.[LeadTime(Weeks)], MinPrices.ExpirationDate
    FROM MinPrices INNER JOIN BOMSearch ON (MinPrices.PartNumber = BOMSearch.[Part Number]) AND (MinPrices.UOM = BOMSearch.[BOM UOM])
    WHERE (((BOMSearch.[BOM Qty])>Qtys.PriceBreakBegin And (BOMSearch.[BOM Qty])<Qtys.PriceBreakEnd) And ((BOMSearch.[BOM UOM])=MinPrices.UOM) And ((MinPrices.PartNumber)=BOMSearch.[Part Number]) And ((MinPrices.ExpirationDate)>=BOMSearch.[DUE DATE]));
    The comparison is from a linked excel which has 5 fields which have matching formats to the formats in my table. I suspect it is my ExpirationDate field, which is a calculated field, but is formatted as a Date/Time in the Access table. I just don't know where the error is occurring.

    I'd prefer to not delete any fields, as I need all of them.

    Ideas?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    Formatted how? With Format function or with Format property? What is the expression that calcs the ExpirationDate?

    Format function results in text value, not a true date. Try:

    And ((CDate(MinPrices.ExpirationDate))>=BOMSearch.[DUE DATE]));
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    Format Property. The expression is DateOfQuote + PriceValidation(Days) = ExpirationDate, where DateOfQuote is a Date, and PriceValidation is a number.

    I tried your suggestion and it worked

    Now, though, I'm not getting any results in my testing phase. I put a part number and quantity in my linked excel that I know is in my database and it is not finding any matches. My linked Excel looks like this:

    Click image for larger version. 

Name:	BomSearch1.png 
Views:	6 
Size:	6.6 KB 
ID:	19930

    I overwrote the PartNumber, but the actual part in that cell is in my database, with a pricebreakbegin of 1, and a pricebreakend of 10. I put in 2, so that should be fine. Both UOM are EA. The due date of the Q# in column A is 2/27/15, whereas my part in access expires in 12/31/15, so that field comparison is ok. Is my SQL correct for the comparisons I need to do?

  4. #4
    gaker10 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2014
    Posts
    262
    UPDATE via Post#3: My Due date vs Expiration Date should be: ((CDate(MinPrices.ExpirationDate))>=CDate(BOMSearch.[DUE DATE])));

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

Similar Threads

  1. Data type mismatch in criteria expression
    By khughes46 in forum Queries
    Replies: 12
    Last Post: 05-01-2014, 07:34 AM
  2. Data Type mismatch in criteria expression
    By elb1999 in forum Queries
    Replies: 2
    Last Post: 01-20-2012, 02:38 PM
  3. Data type mismatch in criteria expression
    By buienxg in forum Access
    Replies: 2
    Last Post: 11-22-2011, 10:29 AM
  4. Data type mismatch in criteria expression
    By Douglasrac in forum Forms
    Replies: 3
    Last Post: 11-23-2010, 10:46 AM
  5. data type mismatch in criteria expression
    By broecher in forum Access
    Replies: 4
    Last Post: 09-10-2010, 08:29 AM

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