Solved

VBA; SetHiddenAttribute

Posted on 2007-03-28
5
984 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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 …

772 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

10 Experts available now in Live!

Get 1:1 Help Now