Results 1 to 2 of 2
  1. #1
    EstesExpress is offline Novice
    Windows XP Access 2003
    Join Date
    Sep 2009
    Posts
    5

    Count records issue


    I need to create a field that counts the number of serial numbers for one location from a table. I have the basic part working but the serial numbers are repeated quite a lot and I only want it to count a serial number once. I tried to use a AND sum([SerialNumber]) at the end of the statement but that was not working.

    =DCount("SerialNumber","dbo_HHUsageHistorical","Ar eaDescription = 'Atlanta, GA'")

  2. #2
    CGM3 is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Atlanta, GA
    Posts
    49
    A bit roundabaout, but it should work (haven't tested it yet):
    Code:
     
         ' This should create a virtual table where each separate Serial Number in Atlanta, GA appears once (that's what DISTINCT does)
         Set rsTemp = CurrentDb.OpenRecordset("SELECT DISTINCT Serial Number FROM dbo_HHUsageHistorical WHERE AreaDescription = 'Atlanta, GA'", dbOpenSnapshot)
       rsTemp.MoveLast
       rsTemp.MoveFirst
        ' RecordCount gives the number of records in the table
         iL = rsTemp.RecordCount
         rsTemp.Close
    Naturally, you'll have to define rsTemp as a recordset, and iL as a long integer, and apply the latter as required.

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

Similar Threads

  1. error in count
    By humpz in forum Reports
    Replies: 6
    Last Post: 08-13-2009, 08:20 AM
  2. count with conditional
    By humpz in forum Reports
    Replies: 3
    Last Post: 08-02-2009, 08:11 AM
  3. Using count or Dcount
    By ddcook in forum Access
    Replies: 0
    Last Post: 07-22-2009, 03:35 PM
  4. how do i do a word count
    By clueless in forum Queries
    Replies: 0
    Last Post: 06-03-2009, 09:01 PM
  5. two fields needing to look like one for a count how?
    By techexpressinc in forum Queries
    Replies: 2
    Last Post: 05-29-2009, 01:06 PM

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