Results 1 to 6 of 6
  1. #1
    Jrw76 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Dec 2013
    Posts
    38

    counting records


    I need to create a query that has two count fields. One will be a total Count of records- I have this, just Count(*). But I need another Count field where [Installed Date] is not null. Im apparently not getting the syntax correct. Also, these need to be conditional on what the user inputs into another field. So, in this query, I need the field "Hull" as one of the fields, and the Criteria to be [Enter Hull Number], so this will only count the number of records that have the "Hull" field equal to what the user inputs.but when I do this, it gives me an error. Do I need to go another route?

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Can you post the SQL code of your query?

  3. #3
    Jrw76 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Dec 2013
    Posts
    38
    Quote Originally Posted by JoeM View Post
    Can you post the SQL code of your query?
    SELECT Count(*) AS [Total Plates]
    FROM [LABEL PLATE DATA];
    SELECT Count('Installed By') AS [Installed]
    FROM [LABEL PLATE DATA] WHERE Installed By Is Not Null;

  4. #4
    Jrw76 is offline Advanced Beginner
    Windows 7 64bit Access 2003
    Join Date
    Dec 2013
    Posts
    38
    The only part that will work is Count(*) AS [Total Plates] FROM [LABEL PLATE DATA];
    Needs to return number of Records where Installed By has a value in it AND Hull = value entered by user.

  5. #5
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    If there is a space in your "Installed By" field name, you will need to enclose it in square brackets (not quotes), i.e. [Installed By]

    Programming tip: Never use spaces, punctuation (other than an underscore), or any special characters in field names. It makes it much easier to work with, and more easily allows conversion to other Programming Languages.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    This is a duplicate topic, solved in https://www.accessforums.net/sql-ser...rds-40761.html

    Posting duplicate threads on same topic is against forum guidelines and just poor forum etiquette.
    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. Counting Records in a Query
    By bomich in forum Access
    Replies: 2
    Last Post: 11-16-2012, 03:00 AM
  2. Counting records
    By mjsabin in forum Access
    Replies: 1
    Last Post: 03-06-2012, 11:11 AM
  3. Counting No of records above the limit.
    By cap.zadi in forum Reports
    Replies: 5
    Last Post: 11-29-2011, 12:51 PM
  4. Counting Only Certain Records
    By jtphenom in forum Queries
    Replies: 9
    Last Post: 03-29-2011, 01:25 AM
  5. Counting Records
    By WhiteNite1971 in forum Access
    Replies: 1
    Last Post: 01-22-2011, 06:36 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