Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hide tables programmatically

    Dear All,

    When I load up my front end on a PC I then have to set the links to the tables on the server. The problem is that this process un-hides the tables.

    I saw some code once that would loop through a collection and programmatically reset an attribute for you.

    I

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Hide tables programmatically

    Hi Rupert,
    I think what you want is something like:
    T.attributes = T.attributes and dbhiddenobject
    to hide the table.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide tables programmatically

    Dear Rory,

    I changed it slightly by adding a

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Hide tables programmatically

    Hi Rupert,
    Sadly I don't know of any way of doing that. I'd be very happy if anyone else does though! You can hide tables by calling them USysTablename (i.e. prefix the name with 'USys') or simply hide the database window.
    Hope that helps?
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide tables programmatically

    Dear Rory,

    where am I?

    1) It works with tables but I can

  6. #6
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Hide tables programmatically

    Rupert,
    To hide the db window, select Tools-Startup and uncheck Show database window. Then click on Advanced, and uncheck Use Access special keys.
    I will look into hiding the linked tables - it's not something I've needed as yet, but might be of use in the future.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

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

    Re: Hide tables programmatically

    Guys, do NOT try to set the dbHiddenObject attribute of a table in code. If you set a user-created table as hidden anywhere except from the user interface, the table disappears nicely from the database window. When you compact the database, it also disappears from there ... permanently. Unfortunately, there is no way to set the UI hidden attribute from code.
    Charlotte

  8. #8
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Hide tables programmatically

    Sorry, Rupert - I was not aware of that! Charlotte, is that documented somewhere? I'd love to know why that is the case.
    Regards,
    Rory

    Microsoft MVP - Excel

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

    Re: Hide tables programmatically

    I can't remember every finding an article on it, but I learned it the hard way. I did have an exchange with Dev Ashish about it, and he indicated that the dbHidden attribute is used internally by Access when you delete database objects. When you "delete" a local object, it has its dbHidden attribute turned on so that you no longer see it but it actually remains in the database until the next time you compact. Basically, what you're doing if you set the dbHiddenObject attribute on an object, is telling Access to delete it!
    Charlotte

  10. #10
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Hide tables programmatically

    nice of them to mention that in the Help files!
    Regards,
    Rory

    Microsoft MVP - Excel

  11. #11
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide tables programmatically

    A general point in what you did. Do not blindly add or subtract like that. Test if the attribute is set before removing or that it is not set before adding otherwise you will not get what you want.
    For example attribue XX is 0 for off and 1 for on. You want to turn it on. If it is already on then after addition the value is 2 and is that off, on or the atrribute YY now switched off?

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

    Re: Hide tables programmatically

    Thanks for pointing that out, Andy. Before anyone tries setting attributes, they should lookup "bitwise operations" and try to bend their brains around it. [img]/w3timages/icons/grin.gif[/img]
    Charlotte

  13. #13
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide tables programmatically

    Dear Rory, Charlotte and AndyAinscow,

    Thank you all for your help on this. I can see that it's probably not possible to do things the way I want so I'll have to work around it, what's new!

    I found this dbHiddenObject thingy quite interesting. I'm using Access 2000 with no SR's. I hid some tables and then compiled the DB; I found I could unhide them, even after compiling.

    I did some other experiments and found that a query based on a table could still "see" and interact with the table after I hid it even though I couldn

  14. #14
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hide tables programmatically

    Back to your original question. Why do you want to hide them?
    I suspect you really want an answer concerning security in the database and hiding an object is not really anything to do with security.

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

    Re: Hide tables programmatically

    Compiling shouldn't affect the tables you hid. Compacting, on the other hand, should zap them. When you set the dbHiddenObject attribute, you are, in effect telling Access you want to delete that object the next time you compact the database. That's why you can't see the object from other databases. The query behavior is what I would expect, since you can do the same thing with system tables, which are hidden using the dbHiddenObject attribute but that's by Access itself. The rules are different if you do it.

    If you have Office, you have VBA, because that's the programming language of Office. Looping through the tabledefs collection in code would locate the tables, but only until the first time you compact the database. Please believe me, this is dangerous and cannot be used the way you want to use it. I agree, it would be handy. That's how I found out that it bites!
    Charlotte

Page 1 of 2 12 LastLast

Posting Permissions

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