Results 1 to 3 of 3
  1. #1
    Nobby2193 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2012
    Posts
    12

    dcount with 2 criteria

    Hi All
    probably easy for you guys but frustrating for me

    I have a form frmStatuslookup and its subform frmStatuslookup _sub. The recordsource for frmStatuslookup _sub is QryStatusLookup

    on the subform I have a combo box called ClientOrDestination with ID and Databasestatus,
    ID databaseStatus
    1 Active
    2 Destination
    3 Inactive
    4 Void

    and a field named Title which has either MR, Mrs, MIss or MS
    In the formfooter of frmStatuslookup _sub I need to count up the occurences of MR from the title field where the contents of the combo box ClientOrDestination column 1 says "Active" I also have the ID field ( which would show 1 for active ) to try to make my dcount easier ??



    I just cannot get a result to this
    my best effort is =DCount("QryStatusLookup","clientordestination","[clientordestination]='Active' And [client]='Mr'") but comes up with error
    Please help

  2. #2
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,861
    your arguments are off.

    Code:
    DCount ( expression, domain, [criteria] )
    the first argument should be the field you are counting or "*" usually works.
    the second argument is the domain. in your case a query.
    the third argument is the criteria. similar to a where clause.

  3. #3
    Nobby2193 is offline Novice
    Windows 10 Access 2016
    Join Date
    Feb 2012
    Posts
    12
    Hi
    Thanks for your prompt reply

    I did it with
    =DCount("*","[QryStatusLookup]","title = 'Mr' And [id]=1")

    Rob

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

Similar Threads

  1. dcount criteria
    By markjkubicki in forum Programming
    Replies: 2
    Last Post: 11-26-2018, 03:01 PM
  2. DCOUNT Muliple criteria
    By civl_eng in forum Access
    Replies: 11
    Last Post: 05-03-2018, 12:27 PM
  3. Using DCount, how to use a variable as the criteria
    By crowegreg in forum Programming
    Replies: 2
    Last Post: 02-17-2015, 05:18 PM
  4. DCount with Multiple Criteria
    By Newbie11 in forum Reports
    Replies: 4
    Last Post: 05-25-2012, 09:04 AM
  5. How do you use DCOUNT for multiple criteria?
    By wwhit in forum Programming
    Replies: 5
    Last Post: 05-15-2012, 11:14 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