Results 1 to 4 of 4
  1. #1
    avalentini is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2018
    Posts
    9

    Display All Records in Continuous Subform without Refreshing

    Hello,

    I have a form with several continuous subforms that I wish to automatically resize based on the number of records they contain. I've been able to do this by having Me![subForm].Form.Section(acDetail).Height a function of Me![subForm].Form.Recordset.RecordCount. The only issue is when I open up the main form or switch from record to record only two records are displayed in the subform. Furthermore, if I run Debug.Print (Me![subForm].Form.Recordset.RecordCount the result is "1". However, if I click the "refresh all" button, all records are shown and the subform resizes itself accordingly. I've tried running Me![subForm].Form.Recordset.MoveLast before the RecordCount operation, but it simply displays the last record in the record set, and printing RecordCount still returns "1".

    Thanks for any help.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    .RecordCount wont work unless you goto the end of the recordset, THEN it gets the count.
    so instead, use DCOUNT("*","qsSubformQuery")

  3. #3
    avalentini is offline Novice
    Windows 10 Access 2016
    Join Date
    Jul 2018
    Posts
    9
    How do I use that function such that it returns the number of records in the subform and not the total number of records in the table the subform is referencing?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    RecordCount code works for me.

    Why even do this? This is why forms have scroll bars. Could there ever be too many records for all to display without scrolling?
    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. Replies: 6
    Last Post: 11-12-2017, 11:51 PM
  2. Replies: 21
    Last Post: 10-13-2016, 03:29 PM
  3. Replies: 2
    Last Post: 03-11-2015, 07:13 AM
  4. Replies: 2
    Last Post: 04-22-2014, 02:48 PM
  5. Replies: 5
    Last Post: 08-24-2013, 08:04 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