Solved

VBA; SetHiddenAttribute

Posted on 2007-03-28
5
1,038 Views
Last Modified: 2012-08-13
Can I use SetHiddenAttribute to hide access tables by connecting to the access db from a separate db.  That is, I want to write a module in db1 to hide tables in db2.  I can get dbi to list table names from db2 but I can't figure out how to set the attributes.
0
Comment
Question by:Shelnutt
5 Comments
 
LVL 84
ID: 18809386
I believe SetHiddenAttribute only works with the current database. YOu can open the remote database and set the attribute like this:

  Dim db As DAO.Database
  Dim td As DAO.TableDef

  Set db = DAO.OpenDatabase("Full path to db")

  Set td = db.TableDefs("NameOFTable")
  td.Attributes = td.Attributes AND dbHiddenObject

  Set td = Nothing
  Set db = Nothing
0
 

Author Comment

by:Shelnutt
ID: 18810448
LSM,
Thank you for the quick response.  I have tried the code you provided and it appears to run, but when I open the target db, the tables are still "not" hidden.  What might I be doing wrong?  Any guesses?
0
 

Accepted Solution

by:
flyinghigh earned 50 total points
ID: 19123942
SetHiddenAttribute also works with remote database. You can hide tables, queries, ....
To hide a table try this:

Dim appAcc As Access.Application
Set appAcc = New Access.Application
 
appAcc.OpenCurrentDatabase "Full path to db"
appAcc.Application.SetHiddenAttribute acTable, "NameOfTable", True
 
appAcc.Quit
Set appAcc = Nothing
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21177270
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question