Record Count mismatch in MS Access Database 2003

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • binal0508
    New Member
    • Jan 2013
    • 2

    Record Count mismatch in MS Access Database 2003

    I am using MS Access Dataabse 2003. I have a table name Jan 2013 IPD Scanlist. This table has total records of 75 count. Now when I execute this query:

    Code:
    SELECT [IPD Scanlist January 2013].Discharge,
       [IPD Scanlist January 2013].MRN,
       [IPD Scanlist January 2013].[Last Name], 
       [IPD Scanlist January 2013].[First Name], 
       [IPD Scanlist January 2013].Admit, 
       [IPD Scanlist January 2013].Therapist, 
       [IPD Scanlist January 2013].[MTP present], 
       [IPD Scanlist January 2013].[MTP Doctor], 
       [IPD Scanlist January 2013].[MTP Therapist], 
       [IPD Scanlist January 2013].[Sent For Scan], 
       [IPD Scanlist January 2013].[Receipt of Scan], 
       [IPD Scanlist January 2013].Notes, 
       [IPD Scanlist January 2013].[MTP Nursing]
    FROM [IPD Scanlist January 2013]
    WHERE ((([IPD Scanlist January 2013].[MTP Therapist])=0)
        AND
          (([IPD Scanlist January 2013].[Receipt of Scan]) Is Null));
    The total records is 14 ...

    When I execute this query :
    Code:
    SELECT [IPD Scanlist January 2013].Discharge, 
       [IPD Scanlist January 2013].MRN, 
       [IPD Scanlist January 2013].[Last Name], 
       [IPD Scanlist January 2013].[First Name], 
       [IPD Scanlist January 2013].Admit, 
       [IPD Scanlist January 2013].Therapist, 
       [IPD Scanlist January 2013].[MTP present], 
       [IPD Scanlist January 2013].[MTP Doctor], 
       [IPD Scanlist January 2013].[MTP Therapist], 
       [IPD Scanlist January 2013].[Sent For Scan], 
       [IPD Scanlist January 2013].[Receipt of Scan], 
       [IPD Scanlist January 2013].Notes, 
       [IPD Scanlist January 2013].[MTP Nursing]
    FROM [IPD Scanlist January 2013]
    WHERE ((([IPD Scanlist January 2013].[MTP Doctor])=0) 
       AND 
          (([IPD Scanlist January 2013].[Receipt of Scan]) Is Null));
    The total records is 18

    When I execute this query:

    Code:
    SELECT [IPD Scanlist January 2013].Discharge, 
       [IPD Scanlist January 2013].MRN, 
       [IPD Scanlist January 2013].[Last Name], 
       [IPD Scanlist January 2013].[First Name], 
       [IPD Scanlist January 2013].Admit, 
       [IPD Scanlist January 2013].Therapist, 
       [IPD Scanlist January 2013].[MTP present], 
       [IPD Scanlist January 2013].[MTP Doctor], 
       [IPD Scanlist January 2013].[MTP Therapist], 
       [IPD Scanlist January 2013].[Sent For Scan], 
       [IPD Scanlist January 2013].[Receipt of Scan], 
       [IPD Scanlist January 2013].Notes, 
       [IPD Scanlist January 2013].[MTP Nursing]
    FROM [IPD Scanlist January 2013]
    WHERE ((([IPD Scanlist January 2013].[Receipt of Scan]) Is Null) 
       AND 
          (([IPD Scanlist January 2013].[MTP Nursing])=0));
    The total record is 29.

    Now when I add all these records 14+18+29=61 where the total records for entire table is 75. So this is where I am facing the problem.

    Please Help.
    Last edited by zmbd; Jan 24 '13, 02:54 PM. Reason: [Z{Please use the <CODE/> button to format posted code/html/sql}{Stepped the SQL For better Read}]
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Not to state the obvious; however, it would be be logical to assume that your queries lack the correct overlap/bounding to retreve the entire dataset using the parameters.

    It also appears that your database may not be normalized given the names of the fields. You may want to take a look at my two favorite links for this:
    A Tutorial for Access

    Database Normalization and Table Structures.

    Comment

    • binal0508
      New Member
      • Jan 2013
      • 2

      #3
      Thanks a lot. I will consider your input and see how it works.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You have no count of not null records. Otherwise, what's the point of having a column that will always be null? You also do not account for those fields where the value is not 0. And you do not account for those where multiple fields can be 0.

        Comment

        • NeoPa
          Recognized Expert Moderator MVP
          • Oct 2006
          • 32663

          #5
          All records where [Receipt of Scan] is other than Null will be excluded from all your queries.
          Any records which have a zero in more than one of the listed fields ([MTP Therapist]; [MTP Doctor]; [MTP Nursing]) will be counted more than once.
          Any records which have non-zero values in all of those fields from the previous list will not be counted.

          I would be very surprised (from the information you have shared in the question) if the numbers you quote had any logical connection at all with each other.

          Comment

          Working...