Results 1 to 10 of 10
  1. #1
    nichmeg is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2011
    Posts
    31

    subform visibility


    I have inserted a subform with the contact information. The subform's visibility is set to no and a command button has been set up to change the visibility. This all works fine, but I would like to have the subform return to not visible upon changing the record or tab (meaning when you leave the tab its on that it disappears). I have tried several ways and am having it visible until I close the database out and reopen it.
    Any suggestions?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Show the code you attempted. If you leave the tab, why does it matter if it is visible?
    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.

  3. #3
    nichmeg is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2011
    Posts
    31
    Quote Originally Posted by June7 View Post
    Show the code you attempted. If you leave the tab, why does it matter if it is visible?
    I guess leaving the tab really matter, its when I go to a new record that I am more concerned with to clean up the look. I have tried using
    Me.requery in numerous events as well as me.building_contact_subform.visible = false in the event sequences too. Maybe im trying to over simplify.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    When you go to new record on the main form? The subform would not have any records so even if it is visible it is empty. That is undesirable?

    You would not set the subform Visible property, but the property of the subform container control. I always give the container a name different from the form it holds, like ctrBuildingContact.
    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.

  5. #5
    nichmeg is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2011
    Posts
    31
    You will probably understand when you see what I am trying to do (Ive included a copy.) I want the contacts subform to open when you click the contact button and when you switch the records it would hide the subform again (requiring the user to click contact button again).

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    How would I 'switch the records' - with the Navigation bar at bottom of main form? Still don't understand why the subform needs to be not visible, even when the form first opens. The subform records remain in sync with the main form. That seems a good thing. Personally, I would just leave it open and not annoy the user with another button click.

    However, if you want to hide the subform, put code in the OnCurrent event of the main form. When form moves to another record this event will execute. Now I see you already do this for other controls in the Current event. Do the same for the subform container.
    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.

  7. #7
    nichmeg is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2011
    Posts
    31
    got it thanks. Guess I tried every event but that. Im trying to decide about leaving it open, just want it to look pretty. Thanks again

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I think still looks nice with the subform displayed. And one less click for users to bother with.

    Are you aware of the shortcut key feature? Place an ampersand (&) before any character of button caption (or a label associated with a button, checkbox, radio button, or pages of a tab control) and can type Alt+character to execute that control click event. This is for people who are comfortable using keyboard commands and prefer not to jump to mouse for every button click. If there aren't any data entry controls (textbox, combobox, listbox) on the form, such as a menu form, don't even need the Alt prefix.

    If you want a more 'Windows' like appearance, set project to Overlapping Windows instead of Tabbed Documents.
    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.

  9. #9
    nichmeg is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2011
    Posts
    31
    I think I agree with you, after looking at it both ways, I like how it looks with the subform always open (once it was adjusted to size). One little thing that I would like to tweek is that when a record has more contacts than is visible in the subform it adds a vertical scroll bar which makes it wider than the subform box, thus adding a horizontal scroll bar too. Is there a way to have the subform box auto resize to fit the columns so that the horizontal scroll bar doesnt show up?

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Can make the subform and/or container a little wider to handle the vertical scroll when it is active. Otherwise, will need code that checks how many records are displayed in the subform and if exceeds a limit, code the subform/container to resize width.

    I would just make it wider. So the last field has a little more space than needed with fewer records. Users won't even notice.
    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: 3
    Last Post: 09-08-2011, 10:53 AM
  2. Replies: 3
    Last Post: 01-13-2011, 03:53 AM
  3. Visibility based on Combo selection
    By jlclark4 in forum Forms
    Replies: 1
    Last Post: 12-22-2010, 11:42 AM
  4. Visibility of other controls
    By jlclark4 in forum Forms
    Replies: 7
    Last Post: 12-15-2010, 12:34 PM
  5. Replies: 0
    Last Post: 11-24-2009, 03:23 PM

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