Results 1 to 12 of 12
  1. #1
    Join Date
    Feb 2004
    Posts
    67

    Unanswered: Hide a table using VBA

    I have a module that creates a Table. I would like the same module to "Hide" the Table so the User does not see it with the other Table Objects.

    Is there a way to do this?

    I tried the following:

    Dim tdf As ADOX.Table
    Set tdf = New ADOX.Table
    tdf.Hide

    I get an error message "Method or Data Method Not Found".


    Thanks much for any help.

    Jim

  2. #2
    Join Date
    Dec 2003
    Posts
    268

    Hidding Table

    try

    tdf.dbhiddenobject = true

    Dont know if this works, I am just looking under the object browser for tabledef.

    HTH

  3. #3
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Dim cat As New ADOX.Catalog
    Dim tbl As ADOX.Table
    Dim prp As ADOX.Property
    cat.ActiveConnection = CurrentProject.Connection
    Set tbl = cat.Tables("a")
    tbl.Properties("Jet OLEDB:Table Hidden In Access") = True

    Note: Your user can still see the table if they have the View option of show hidden tables checked
    All code ADO/ADOX unless otherwise specified.
    Mike.

  4. #4
    Join Date
    Feb 2004
    Posts
    67

    Re: Hidding Table

    Originally posted by mjweyland
    try

    tdf.dbhiddenobject = true

    Dont know if this works, I am just looking under the object browser for tabledef.

    HTH
    HTH,

    Thanks much for the suggestion, but I get the same compilation error message: "Method or Data Member Not Found"

    Jim

  5. #5
    Join Date
    Feb 2004
    Posts
    67
    Originally posted by HomerBoo
    Dim cat As New ADOX.Catalog
    Dim tbl As ADOX.Table
    Dim prp As ADOX.Property
    cat.ActiveConnection = CurrentProject.Connection
    Set tbl = cat.Tables("a")
    tbl.Properties("Jet OLEDB:Table Hidden In Access") = True

    Note: Your user can still see the table if they have the View option of show hidden tables checked
    Thank you for your help, but I get the following error message: "Items cannot be found in the collection corresponding to the requested name or ordinal". Do I need a specific "reference" for your suggestion to work.

    Thanks again.

    Jim

  6. #6
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    I think you may have directly copied and pasted the supplied code and suspect you don't have a table called "a".

    The fact that an item can't be found in a collection is usually an indicator of a mis-spelled item or an ordinal number <0 or > the total number of items -1, not a reference problem.

    Reference probs are usu a compile error of user defined type not defined, or something else with non-helpful wording.
    All code ADO/ADOX unless otherwise specified.
    Mike.

  7. #7
    Join Date
    Feb 2004
    Posts
    67
    Originally posted by HomerBoo
    I think you may have directly copied and pasted the supplied code and suspect you don't have a table called "a".

    The fact that an item can't be found in a collection is usually an indicator of a mis-spelled item or an ordinal number <0 or > the total number of items -1, not a reference problem.

    Reference probs are usu a compile error of user defined type not defined, or something else with non-helpful wording.
    HomerBoo,

    Thanks very much. You were exactly correct. Once I replaced "a" with the actual Table Name, everything worked great. Sorry for my stupidity.

    Thanks again.

    Jim

  8. #8
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Try to preface the table's name with 'Usys'. S

    uppose your table is called Orders, to hide it, rename it to UsysOrders

  9. #9
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    hammbakka: Why?
    All code ADO/ADOX unless otherwise specified.
    Mike.

  10. #10
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Originally posted by HomerBoo
    hammbakka: Why?
    I've read on a site "In order to hide a table, just preface the table's name with 'Usys'"

    I haven't tried it yet.

  11. #11
    Join Date
    Feb 2004
    Posts
    67
    Originally posted by hammbakka
    Try to preface the table's name with 'Usys'. S

    uppose your table is called Orders, to hide it, rename it to UsysOrders
    Thanks much for your suggestion. Actually, I tried HomerBoo's code and it works fine.

    Thanks again.

    Jim

  12. #12
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Hmm, I think prepending with USys turns it into a User System table. The table is visble when you have the System Objects View Option checked, but isn't really a hidden table. This property still persists: Jet OLEDB:Table Hidden In Access, False.

    I think it just appears hidden as the System tables are hidden by default.

    Just mild curiosity really, not trying to prove anything other than 2 is really a prime number.
    All code ADO/ADOX unless otherwise specified.
    Mike.

Posting Permissions

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