Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Which Event? (Access 2000)

    I want to do something somewhat similar to post <post#=296670>post 296670</post#> . I want to make the subform visible or invisible depending on whether or not there are any records to be displayed in the subform. If there are no records, I want to reset the visible property to false, else set it to true. I know how to construct the VBA code but I'm not sure in which event to insert it.

    Any help would be greatly appreciated.
    Carol W.

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Wetherby, Yorkshire, England
    Posts
    283
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Which Event? (Access 2000)

    <P ID="edit" class=small>(Edited by WendellB on 24-Sep-03 12:44. more cleary identify the answer and its source.)</P>It gives you the answer (along with many other answers) MVPs Access Web . Look in the Forms section first (#155) before you explore the rest.
    Peter

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Which Event? (Access 2000)

    The answer depends on how the form is supposed to work. If you want it to be really rock solid, you should probably use DAO (or ADO) to open a recordset that will match the stuff that goes on behind the scenes with subforms, and determine how many records you get from that recordset. But there would be some performance penalties in doing that. I presume that the form you are working with will be display only so that you can't add records to it (otherwise you wouldn't want to hide the empty subform) - so you could set the property that prevents you from adding records on the subform, always have the subform hidden to start, and then test to see if the linking value on the subform is null. I haven't tested that approach, so you may have to turn on the ability to add records to be able to refer to the linking control. Let us know how you fare.

    (After posting this I see that <!profile=herworth>herworth<!/profile> has posted a more elegant approach using the RecordsetClone method.)
    Wendell

  4. #4
    3 Star Lounger
    Join Date
    Dec 2001
    Location
    Nevada, USA
    Posts
    207
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Which Event? (Access 2000)

    # 155 did the trick!

    <img src=/S/thankyou.gif border=0 alt=thankyou width=40 height=15>
    Carol W.

Posting Permissions

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