Results 1 to 2 of 2
  1. #1
    greatwhite is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2019
    Location
    Ottawa, ON
    Posts
    56

    Hiding Subforms when no data


    OK I have several Subforms on a form, I would like to know if there is someway that when the Subform has no data I can hide it and everything sort of shifts up as if the Subform was not there.

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Yes you can but I suggest you make it hidden by default and visible when there is data. For example

    Code:
    If DCount("*","tableOrQueryName", "filter criteria")>0 Then Me.subformcontrolname.visible=True
    However if you want the subform to shrunk to nothing when it is empty, combine the DCount with code similar to the example in the link
    http://www.mendipdatasystems.co.uk/s...row/4594454012
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Hiding Subreports when thre is no data
    By PinkLady50 in forum Reports
    Replies: 10
    Last Post: 09-06-2017, 02:21 PM
  2. SubForms not displaying data
    By gg80 in forum Forms
    Replies: 5
    Last Post: 05-08-2015, 08:31 PM
  3. Hiding Duplicate Data in a Query
    By swb1 in forum Queries
    Replies: 12
    Last Post: 06-22-2014, 03:55 PM
  4. Subforms to enter data
    By novo in forum Forms
    Replies: 4
    Last Post: 03-01-2013, 02:15 PM
  5. Replies: 5
    Last Post: 01-18-2012, 12:18 AM

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