Results 1 to 10 of 10
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528

    data type mismatch in criteria expression

    Hello guys
    I try to use this expression in the report, but am having this letter
    Code:
    =DCount("*";"QueryAll";"PartID='Cement resistant'")
    data type mismatch in criteria expression


    What is the problem ?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is the PartID field in the QueryAll a number or text? Your error suggests it is a number.

  3. #3
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    Thank you very much Allan
    Yes exactly is the number on the report, but I use (Column Count 3).
    So what is working ?
    I want to do and the liquidation of the materials

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is the PartID field a Lookup Field? If so, that will not work.

  5. #5
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    Thank you Allan
    Is it possible to obtain an expression for Lookup ?

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    I do not think it is possible in an expression using DLookup. The field is a complex data type and I do not think the multi-value field will work.

  7. #7
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    Thank you Mario
    I have used this expression, but also to no avail.
    =Count(IIf([PartID ]="Cement resistant",0))
    Is there any other solution?

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Create a new query object and add "QueryAll" to the design surface.
    Add the column that represents your field.
    Add criteria to your new column.
    Use 'Cement resistant' as the criteria.
    Save your new query and name it.

    Use the name of your new query in your DCount expression.

    Also, there is more than one way. But, I think this is the simplest. Hopefully I am understanding correctly.

  9. #9
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    The same problem Mario
    I have worked as I have a new query
    And used the following expression
    =DCount("*";"Query6";"(PartID = 'Cement resistant' )")
    But it appears to me #ُError

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Does Query6 work correctly? Does it only retrieve the correct number of records?

    If Query6 is working, then ...
    =DCount("[PartID]", "Query6")
    or
    =DCount("*", "Query6")

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

Similar Threads

  1. Data type mismatch in criteria expression.
    By pipoconanan45 in forum Reports
    Replies: 1
    Last Post: 09-09-2015, 06:26 AM
  2. Replies: 5
    Last Post: 02-25-2015, 08:42 AM
  3. Data Type mismatch in criteria expression
    By elb1999 in forum Queries
    Replies: 2
    Last Post: 01-20-2012, 02:38 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