Results 1 to 6 of 6
  1. #1
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283

    DSum([WOO],"tbl_main",[PERCENT_WAY_THROUGH_LEASE]>'100') - datatype mismatch

    I am trying to calculate a field and am getting datatype mismatch error on the 100 section.



    The WOO and PERCENT_WAY_THROUGH_LEASE fields are both set to Long Integer in the table.

    I am trying to sum the WOO field where the PERCENT_WAY_THROUGH_LEASE is greater than 100. I have tried single quotes, double quotes and no quotes around the 100 with the same error each time.

    If I choose Woo as the column and sum it works. It is only when I try to add the criteria that it throws the error.

    The table is joined to another table but it is not joined on either of these fields.


    Any help would be awesome

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,906
    No quotes are there for the criteria or the field being summed and as 100 is a number that should not have quotes.?

    Why not check out the syntax?

    https://support.microsoft.com/en-us/...f-386056e61a32
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,002
    I'm surprised that will work without the criteria.

    As gasman has stated the syntax is each section enclosed in quotes as per here:
    http://access.mvps.org/access/general/gen0018.htm
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    Quote Originally Posted by Minty View Post
    I'm surprised that will work without the criteria.

    As gasman has stated the syntax is each section enclosed in quotes as per here:
    http://access.mvps.org/access/general/gen0018.htm

    I noticed that afterwards and fixed it. It is running now. Is there a way to have it group by.

    The query I have has DTT and This calculated field I have the totals on to group by

    I see this:

    DTT Calculated field
    123 23456
    345 23456
    567 23456

    Is there a way to get the value in the calculated field to be broken out by the DTT?
    Like this:

    DTT Calculated Field
    123 7002
    345 4943
    567 11,511

  5. #5
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,002
    It sounds like you need a aggregate query, but organised a little differently?

    Can you post up some example starting data, and the desired output.
    Generally speaking, using Domain functions in queries isn't required, and is very inefficient on larger datasets.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  6. #6
    mindbender is offline Competent Performer
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    283
    [QUOTE=mindbender;476397]I noticed that afterwards and fixed it. It is running now. Is there a way to have it group by.


    Nevermind. Huge brain fart. I figured it out.

    Thanks for the help

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

Similar Threads

  1. Replies: 7
    Last Post: 11-20-2019, 03:22 AM
  2. "Single" Datatype Mayhem.
    By MatthewGrace in forum Programming
    Replies: 7
    Last Post: 06-14-2017, 12:04 AM
  3. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  4. Replies: 13
    Last Post: 12-05-2011, 05:10 AM
  5. aSTR = Dir("C:\*.*") >> "Type Mismatch"
    By JGrant in forum Programming
    Replies: 1
    Last Post: 03-28-2009, 05:17 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