Results 1 to 40 of 40

Thread: [MS Access] - Hide Database Objects

Threaded View

  1. #1

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Arrow [MS Access] - Hide Database Objects

    Ever need to set a Table or other Access DB object to Hidden programmatically? Well here's the way to do it that
    makes the object hidden EVEN if the user unchecks the "Show Hidden Objects" feature in the Options dialog box.

    There are no ways to show the Object unless you programmatically turn it back on.

    Before:


    After:


    VB Code:
    1. 'Copyright © 2005 by RobDog888 (VB/Office Guru™). All Rights reserved.
    2. '
    3. 'Distribution: You can freely use this code in your own
    4. '              applications provided that this copyright
    5. '              is left unchanged, but you may not reproduce
    6. '              or publish this code on any web site, online
    7. '              service, or distribute as source on any
    8. '              media without express permission.
    9. '
    10. 'Requirements:
    11. 'MS Access version 97 (8.0) - 2003 (11.0)
    12. '
    13. '
    14. 'In a Module:
    15. Option Explicit
    16. Option Compare Database
    17.  
    18. Public Sub HideTable(ByVal sTableName As String)
    19.     Application.CurrentDb.TableDefs(sTableName).Properties("Attributes").Value = dbHiddenObject
    20. End Sub
    21.  
    22. Public Sub ShowTable(ByVal sTableName As String)
    23.     Application.CurrentDb.TableDefs(sTableName).Properties("Attributes").Value = 0
    24. End Sub
    25. '
    26. '
    27. '*********************************************************
    28. '
    29. 'Example usage:
    30. 'Behind a Form
    31. '
    32. '
    33. Option Explicit
    34. Option Compare Database
    35.  
    36. Private Sub cmdHide_Click()
    37.     HideTable "Table1"
    38. End Sub
    39.  
    40. Private Sub cmdShow_Click()
    41.     ShowTable "Table1"
    42. End Sub
    Gangsta Yoda
    Attached Images Attached Images   
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width