Solved

VBA; SetHiddenAttribute

Posted on 2007-03-28
5
1,001 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

863 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now