Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2012
    Posts
    22

    Unanswered: Counting Null Values In A Query

    I am trying to count all values in a table, but when I do it leaves out any that have no values yet or are null. I believe that the Count Method in Access doesn't allow the count of null values but is there a way to make the Count Method include nulls that I can just throw into the Criteria or something like that? if not how would I go about having the Count Method display those nulls? I am using the Count() function in SQL with Access 2003.

    Any help would be appreciated!
    Last edited by DrewMan; 04-23-12 at 15:31.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Depending on whether you use the DCount() function in VBA or the COUNT() function in SQL, have a look at one of these to pages.
    - For the DCount() function: DCount Function [Access 2003 VBA Language Reference]
    - For the SQL COUNT() function: Count Function - Access - Office.com
    Have a nice day!

  3. #3
    Join Date
    Apr 2012
    Posts
    22
    That helps but I am using Access 2003 and I have a table lets call it Items.
    In this table I got numbers and Lines like so:

    Number
    1650
    1651
    1652
    1653

    These numbers have lines in another column like so:
    Column 1 Column 2
    Number Lines
    1650 5
    1651
    1652 10
    1653 90

    The number 1651 exists but it doesn't show up with Count because it doesn't show anything. What's the best way to go about solving this type of problem? Since I run a query it shows the numbers 1650, 1652, and 1653 but no 1651.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Code:
    SELECT COUNT(*) FROM Mytable;
    Or
    Code:
    lngCount = DCount("*", "MyTable")
    Don't you confuse Count() with Sum()?
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •