Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code for hiding database objects like tables, queries etc.

Status
Not open for further replies.

ssatech

Technical User
Feb 27, 2003
361
IE
Code for hiding tables, queries, forms, reports and modules in a database. I know you can hide them by right-clicking properties and checking the hidden attributes.

But is there an easy way to code and hide all the database objects.

Any help appreciated,
 
Try:
[tt]application.sethiddenattribute actable,"tablename",true[/tt]

To make it more automatic, loop thru the the collections, just remember to avoid manipulating the system tables;-)

Here a snippet for forms:

[tt]dim frm as object
for each frm in currentproject.allforms
application.sethiddenattribute actable,frm.name,true
next frm[/tt]

2000+ versions

Roy-Vidar
 
Gee - replace actable in the snippet with acform, hope that's the only typo [blush]

Roy-Vidar
 
Hey! I've been searching for a way to do this and stumbled accross this post. I tried the loop for the forms, reports and macros and it worked like a charm. But I can't get it to work for the tables or the queries. Any ideas why not?

Here's what I have:

Dim tbl As Object
For Each tbl In CurrentProject.AllTables
Application.SetHiddenAttribute acTable, tbl.Name, True
Next tbl

and

Dim qry As Object
For Each qry In CurrentProject.AllQueries
Application.SetHiddenAttribute acQuery, qry.Name, True
Next qry



Thanks!

Paul
 
[tt]dim qdf as dao.querydef
on error resume next
for each qdf in currentdb.querydefs
application.sethiddenattribute acquery, qdf.name, true
next qdf

dim tbl as dao.tabledef
for each tbl in currentdb.tabledefs
application.sethiddenattribute actable, tbl.name, true
next tbl[/tt]

On Error Resume next, bacause there are certain tables and queries you can't manipulate.

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top