Solved

VBA; SetHiddenAttribute

Posted on 2007-03-28
5
1,076 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 85
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

628 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