Results 1 to 12 of 12
  1. #1
    New Lounger
    Join Date
    Mar 2002
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hid a table (2k or 97 )

    How can i hid a table in my MDB .
    Thanks advanse
    Ashraf

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hid a table (2k or 97 )

    Right click on the table name.
    Choose Properties.
    Check the Attribute Hidden Checkbox.
    Select Apply
    Francois

  3. #3
    New Lounger
    Join Date
    Mar 2002
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hid a table (2k or 97 )

    Thank u dear Francois for ur quick replay , but i know that i want to hid the tabel by CODE .
    Ashraf

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hid a table (2k or 97 )

    To hide a table use :
    <pre>CurrentDb.TableDefs("table1").Attributes = dbHiddenObject</pre>

    To unhide a table use :
    <pre>CurrentDb.TableDefs("table1").Attributes = 0</pre>

    Francois

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Edmonton, Alberta, Canada
    Posts
    326
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hid a table (2k or 97 )

    See http://www.mvps.org/access/bugs/bugs0036.htm before setting dbHiddenObject! <img src=/S/bummer.gif border=0 alt=bummer width=15 height=15>

  6. #6
    New Lounger
    Join Date
    Mar 2002
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hid a table (2k or 97 )

    Thank u 4 all very much . It works good
    Ashraf

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

    Re: Hid a table (2k or 97 )

    Has this condition been fixed with a service patch or with Access 2002? It seems like a pretty nasty bug. I checked the help file for Access 2002 and it gives a slightly different syntax for hiding or unhiding a table. In any event, I can't see why you would want to do it in code to begin with. In general you don't want your users messing with tables anyhow. We do have a couple of cases where we have very experienced users who may do filters or queries on tables, and in those cases we may hide some tables. An interesting subject!
    Wendell

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Hid a table (2k or 97 )

    Don't compact your database or all those hidden tables will be gone permanently.
    Charlotte

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Hid a table (2k or 97 )

    It isn't exactly a bug. The UI hidden checkbox sets a flag in MSysObjects, it doesn't change an attribute of the table itself. In Access 2k and later, you should be able to set the UI hidden property from code using SetOption.
    Charlotte

  10. #10
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Hid a table (2k or 97 )

    Out of curiousity (I've never heard of this alleged bug before) I tried this (repeatedly) and the table hidden using dbHiddenObject attribute was NOT deleted after compacting the database. After compacting, made hidden table visible again by using <pre>CurrentDB.TableDefs("HIDDEN").Attributes = 0</pre>

    Of course you then have to enter F5 to refresh the database window display to see the table. I have no interest in hiding tables since I normally use user-level security to prevent users from accessing tables directly, but it was useful to note that the dbHiddenObject attribute really hides the object, while the UI flag method can be defeated by anyone with the sense to check the "Hidden Objects" box in the Options/View dialog. (I'm using A2K SR-1A.)

  11. #11
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Hid a table (2k or 97 )

    All I can tell you is that in A97, I *was* bitten by that bug. It was real and there and a compact permanently removed the tables flagged as dbHiddenObject. That being the case, I never bothered to play with it in A2k, since I never let my users see the databasewindow anyhow. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>. However, you can test to see whether you actually set the dbHiddenObject attribute or the UI flag by checking the MSysObjects table. If you haven't followed the link to Dev Ashish's article, I'd suggest you read it since he explains it better than I can.
    Charlotte

  12. #12
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Hid a table (2k or 97 )

    I tried this in ACC 97 (which I rarely use) and you're right, the hidden table was deleted after compacting. I did check out the article but it did not specify which version(s) of Access were applicable.

Posting Permissions

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