Results 1 to 7 of 7
  1. #1
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215

    DCount help

    I can't seem to get my dcount function to work properly...

    I have a Table "StatusT" and a field within StatusT called "Metric". All that I want to do is count the number of records that contain a certain metric.

    I figured I would do,

    DCount(StatusT!Metric, StatusT, Metric = "Whatever")



    but this does not work.

    Any suggestions?

  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,643
    This should get you started:

    DLookup Usage Samples
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215
    Thanks,

    That actually worked for the DCount. I didn't realize that there were " ' " quotes that you needed to put into the mix, that stuff is confusing!

    Thank you, though.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    No problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by McArthurGDM View Post

    That actually worked for the DCount
    FYI, the same syntax works for most Criteria of Domain Functions(DCount, DLookup, DSum, etc.) as well as for the Where Conditions in things like

    DoCmd.OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs)

    and in working directly with Recordsets.

    Linq ;0)>

  6. #6
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215
    Say I want to do a DLookup on a field "Status" from the table "StatusT"

    But then set the criteria to look on the field "ID1" where

    ID1 = [Forms]![MainNavigation]![NavigationSubform].[Form]![EditMetric].[Form]![EMMetricID].Str(1)
    Or
    ID1 = [Forms]![MainNavigation]![NavigationSubform].[Form]![EditMetric].[Form]![EMMetricID].Str(2)
    Or
    ID1 = ... So on
    .
    .
    .

    So, as you can see, the DLookup references a form, but then then is extended upon by a "." and Str(i) for some variable Str that is from a string array.

    I can't seem to get the syntax write on this one...it's irritating! How would I write this?

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    Don't like and don't use navigation form/control. Review https://www.accessforums.net/forms/t...orm-32053.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.

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

Similar Threads

  1. DCount
    By Newbie11 in forum Reports
    Replies: 4
    Last Post: 08-03-2012, 12:23 AM
  2. DCount
    By nsteenhaut in forum Queries
    Replies: 2
    Last Post: 10-04-2011, 05:00 PM
  3. DCount and If
    By Madmax in forum Access
    Replies: 3
    Last Post: 07-28-2011, 06:53 AM
  4. DCount and SQL
    By DSTR3 in forum Queries
    Replies: 3
    Last Post: 12-06-2010, 03:07 PM
  5. Help with Dcount
    By tozey in forum Programming
    Replies: 1
    Last Post: 08-10-2010, 10:53 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