Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Posts
    56

    Unanswered: Showing subform's row count on main form

    How can I add a field to my main form that dynamically shows the total # of rows shown in a subform? (I then want to use that count for another field on the main form that has a mathmatical equation.)

    I've tried doing a count on the subform in the header/footer then referencing that subform field in the main form but that doesn't work. With reports, I've summed fields in a subform and showed it on the main form but I can't find a similar approach (though I'm now doing count, not sum) for forms.

    Sounds easy but....

    Thanks in advance for any detailed, accurate replies you can provide.

  2. #2
    Join Date
    May 2004
    Posts
    16
    Can you take the easy way out and make the Record Selector visible in the subform? Then you get the record count for free (but it is not available for calculations).

    To use the count for another calculation, you will probably need to use the AfterUpdate event of your combo box that chooses the master record and then run a DCount function that populates a text box on the main form. Domain functions are expensive (per the Access help system, which is pretty helpful on DCount, DSum, etc.) but if you need it you need it. You can also put the DCount directly in a text box and force a refresh of the text box if it doesn't already happen automatically.

  3. #3
    Join Date
    May 2004
    Posts
    16
    Sorry, the Count function is much more efficient than DCount is all you want is the number of records. Look up "DCount" in Access help for an excellent tutorial on DCount and Count.

Posting Permissions

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