Results 1 to 3 of 3
  1. #1
    sdel_nevo is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402

    Dcount with "and" & "or"

    Hi Guys



    I am having problems with this Dcount

    Code:
        DPlatePerCentCheck = Nz(DCount("TestName", "tblTestsResults", "PartNumberID=" & Me.PartNumberID & "and ProductionOrderNumber='" & Me.PONumber & "'" & "And TestName='Plate Thickness (Microns)'" & "And Area='KDM'" & "And Archived = False"), 0)
    the above Dcount works really well it counts the "testName" as expected, for only the area "KDM" but what I cant seem to do is this

    Code:
        DPlatePerCentCheck = Nz(DCount("TestName", "tblTestsResults", "PartNumberID=" & Me.PartNumberID & "and ProductionOrderNumber='" & Me.PONumber & "'" & "And TestName='Plate Thickness (Microns)'" & "And Area='KDM'" & "Or Area='Plating'" & "And Archived = False"), 0)
    what I need to do is count the testname "Plate Thickness (Microns)" if there are values for KDM or Plating

    when I run this the value of DPlatePerCentCheck is counting the tests for both the KDM and Plating areas even if the partnumber has only got tests recorded for "KDM" and like wise if the partnumber has only got test results for the "Plating" area

    each partnumber id goes through many processes or "areas" in the factory so I am trying to just return the values for the two "KDM" or "Plating" and ignor the reset
    not all part numbers go through every area which I why I thought about using the "OR"

    any help would be fantastic,

    Hope this makes sense

    Steve

  2. #2
    Join Date
    Apr 2017
    Posts
    1,792
    ... AND (Area = 'KDM'' OR Area = 'Plating')...

  3. #3
    sdel_nevo is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    Hi

    many thanks

    code below works brill

    Code:
     DPlatePerCentCheck = Nz(DCount("TestName", "tblTestsResults", "PartNumberID=" & Me.PartNumberID & "and ProductionOrderNumber='" & Me.PONumber & "'" & "And TestName='Plate Thickness (Microns)'" & "AND (Area = 'KDM' OR Area = 'Plating')" & "And Archived = False"), 0)
    many thanks for the help

    Steve

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

Similar Threads

  1. Replies: 3
    Last Post: 07-28-2017, 12:12 PM
  2. Replies: 2
    Last Post: 12-23-2015, 09:32 PM
  3. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  4. Replies: 1
    Last Post: 09-03-2014, 03:27 AM
  5. Replies: 11
    Last Post: 03-29-2012, 02:32 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