Results 1 to 5 of 5
  1. #1
    dahota is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jun 2015
    Posts
    2

    Help me ! using Dsum with criteria day

    when click "Search" with day on textbox [t1]>12 it run correct, but textbox [t1]=<12 is incorrect


    (my computer using office 2003, format day : dd/mm/yyyy).
    please help me!
    Thank all!
    Attached Files Attached Files

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can't look at the sample, but it should be <=. You'd think it would work either way, but the <> needs to be first.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Access date standard is mm/dd/yyyy. dd/mm/yyyy is international (non-U.S.) structure. Review: http://allenbrowne.com/ser-36.html
    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.

  4. #4
    IrogSinta is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jun 2015
    Posts
    103
    What you're trying to do with all those DSums can easily done in a query. Copy the following to the SQL View in your query design and run it.
    Code:
    SELECT ts.lnofcno, Sum(IIf([plgdt]=[MyDate] And [clholdcd]="N",[soluong],0)) AS Import, Sum(IIf([ngayxuat]=[MyDate] And [clholdcd]="X",[soluong],0)) AS Export, Sum(IIf([plgdt]<=[MyDate] And [clholdcd]="N",[soluong],0)) AS [End]
    FROM ts
    WHERE (((ts.plgdt)<=[MyDate]) AND ((ts.cltpcd)="[Bất động sản]")) OR (((ts.cltpcd)="[Bất động sản]") AND ((ts.ngayxuat)=[MyDate]))
    GROUP BY ts.lnofcno;
    You didn't have any code to populate dk so that is not included here.

    Ron

  5. #5
    dahota is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jun 2015
    Posts
    2
    Quote Originally Posted by IrogSinta View Post
    What you're trying to do with all those DSums can easily done in a query. Copy the following to the SQL View in your query design and run it.
    Code:
    SELECT ts.lnofcno, Sum(IIf([plgdt]=[MyDate] And [clholdcd]="N",[soluong],0)) AS Import, Sum(IIf([ngayxuat]=[MyDate] And [clholdcd]="X",[soluong],0)) AS Export, Sum(IIf([plgdt]<=[MyDate] And [clholdcd]="N",[soluong],0)) AS [End]
    FROM ts
    WHERE (((ts.plgdt)<=[MyDate]) AND ((ts.cltpcd)="[Bất động sản]")) OR (((ts.cltpcd)="[Bất động sản]") AND ((ts.ngayxuat)=[MyDate]))
    GROUP BY ts.lnofcno;
    You didn't have any code to populate dk so that is not included here.

    Ron
    thank you very much!

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

Similar Threads

  1. Dsum criteria
    By Manuel Ferreira in forum Access
    Replies: 4
    Last Post: 09-12-2014, 09:54 AM
  2. dsum with criteria Not like 38,39,40,41
    By sdel_nevo in forum Programming
    Replies: 3
    Last Post: 06-13-2013, 03:23 PM
  3. Dsum criteria
    By bdaniel in forum Queries
    Replies: 4
    Last Post: 11-27-2011, 03:41 PM
  4. Dsum criteria problem
    By leonhuynh2006 in forum Queries
    Replies: 3
    Last Post: 10-04-2011, 03:18 AM
  5. How to use a create a DSum with multiple criteria
    By FlyingDisc in forum Reports
    Replies: 1
    Last Post: 01-05-2011, 08:31 PM

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