Results 1 to 2 of 2
  1. #1
    pipoconanan45's Avatar
    pipoconanan45 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2015
    Posts
    5

    Question Data type mismatch in criteria expression.

    Hi everyone.

    Im trying to make report where a textbox displays the sum of all the value of a specific field if condition is met.

    This is my code.
    Code:
    =Sum(IIf([FieldID]="1",[FieldData],0))
    The Data type of [FieldData] is Number and the "Field Size" is Double. Im using double because the data have to have up to 2 decimal place. I think this is the reason for the error.

    Ive used this code before but when I tried to use it again I get this error.


    Click image for larger version. 

Name:	adadasdaasd.png 
Views:	7 
Size:	17.8 KB 
ID:	21986

    I also tried using this code but it ignores the condition and displays the sum of all the data in the [FieldData].
    Code:
    =IIf([FieldID]="1",(Sum([FieldData])),0)
    Is there anyway to solve this? Thank you in Advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    this should be done in the query, not the report (but it can)
    this way the report just points to fields.

    But access cannot sum strings. check the [FieldID]="1"
    ID s are not usually strings, they are numeric...
    iif([FieldID]=1,sum())


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

Similar Threads

  1. Replies: 5
    Last Post: 02-25-2015, 08:42 AM
  2. Data Type Mismatch in Criteria Expression
    By dehdahdoh in forum Queries
    Replies: 13
    Last Post: 05-01-2013, 11:41 AM
  3. Data type mismatch in criteria expression
    By bobt_1234 in forum Queries
    Replies: 3
    Last Post: 02-13-2012, 03:37 PM
  4. Data type mismatch in criteria expression
    By buienxg in forum Access
    Replies: 2
    Last Post: 11-22-2011, 10:29 AM
  5. Data type mismatch in criteria expression
    By Douglasrac in forum Forms
    Replies: 3
    Last Post: 11-23-2010, 10:46 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