Results 1 to 6 of 6
  1. #1
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544

    Question Display record count


    I would like to display the count of records on the form. I don't want to display this in the query/table, just on the form. Any suggestions? I feel as though this should be simple, but haven't been able to find the solution yet.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    how about a recordset clone? or alllen browne's ecount function with a unique field? or using a dcount function with any table field? any of those will be fine.

  3. #3
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    Not sure if DCount() will work. Maybe I can explain what I'm trying to accomplish and you'll have a better method of doing it...

    What I want to do is display (Count/Sum in report footer) the first 996 records. However, I don't want to alter the data in the underlying query/table.

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    you want to aggregate the first 996 records? hmmm....I doubt you can do it easily. what's the source? a query? table?

    more than likely, you'll have to create another query or something similar in code to get the number you want. you can always destroy it after you get from it what you need to, because a control source on an unbound control can always be set from temporary memory, and at that point it's permanent on the report until changed again.

    e.g.
    Code:
    control source: "="my value""

  5. #5
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    The source is a table. How would I go about obtaining the record count from the table?

    My thought was to assign the text-box in the record the count, then run a filter for anything less than or equal to 996.

  6. #6
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    jg,

    as I said, it might have to be dynamic. I'm not sure if you can run TOP with an aggregate function, but you might try it. so, for example, create a dynamic query and aggregate the data, then reference it in a tbox. first, maybe:
    Code:
    dim q as dao.querydef
    dim s as string
    
    s = "select TOP 996 field1, sum(field2) as mysum " & _
         "from table group by field1"
    
    set q = currentdb.createquerydef("qtemp", s)
    then reference it:
    Code:
    =qtemp!field2
    or, a lookup function might be needed, with no 3rd parameter, as the direct reference may not work in a control source like that.

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

Similar Threads

  1. Record Count
    By jgelpi16 in forum Queries
    Replies: 4
    Last Post: 12-02-2010, 09:22 AM
  2. How do I display the last record?
    By daddylongtoe in forum Access
    Replies: 1
    Last Post: 06-21-2010, 10:01 AM
  3. remove record count
    By theITguy in forum Access
    Replies: 1
    Last Post: 03-06-2009, 06:22 PM
  4. Form Record Count
    By Texaine in forum Forms
    Replies: 0
    Last Post: 10-19-2006, 09:07 AM
  5. How to display data from another record
    By rodrigo in forum Access
    Replies: 1
    Last Post: 07-24-2006, 07:29 PM

Tags for this Thread

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