Hello to all you forum goers,
I have another one of my random (to most people) questions
i want a vb routine to hide and unhide tables in access (obviously)
i was thinking of something like this - Dim tdf As DAO.TableDef
-
For Each tdf In CurrentDb.TableDefs
-
tdf.Attributes = dbHiddenObject
-
next
but i want to exclude the system tables etc,
and im not sure what the attribude code is for a normal table to unhide it,
im sure this is an easy one for the experts
thanks in advance
Dan
I've created a simple Public Sub-Routine for you that will Hide/Unhide any Table. Simply pass to the Routine the Table Name (String), and a Boolean Value (True/False) indicating whether or not to Hide the Table or Unhide it. - Sub-Routine definition:
- Public Sub HideTable(strTableName As String, blnHide As Boolean)
-
Application.SetHiddenAttribute acTable, strTableName, blnHide
-
End Sub
- Sample usage:
- 'To Hide Table1
-
Call HideTable("Table1", True)
-
-
'To Unhide Table1
-
Call HideTable("Table1", False)
- To Hide/Unhide ALL Tables excluding System and Temporary Tables:
- Dim tdf As DAO.TableDef
-
-
For Each tdf In CurrentDb.TableDefs
-
If Mid$(tdf.Name, 2, 3) <> "Sys" And Left$(tdf.Name, 1) <> "~" Then
-
Call HideTable(tdf.Name, True) 'Hide
-
'Call HideTable(tdf.Name, False) 'Unhide
-
End If
-
Next
- Some other useless code:
- Public Function fIsTableHidden(strTableName As String) As Boolean
-
fIsTableHidden = Application.GetHiddenAttribute(acTable, strTableName)
-
End Function
- Useless code usage (is that redundant?):
- If fIsTableHidden("Table1") Then
-
MsgBox "Table1 is Hidden"
-
Else
-
MsgBox "Table1 is NOT Hidden"
-
End If
4 7267
I've created a simple Public Sub-Routine for you that will Hide/Unhide any Table. Simply pass to the Routine the Table Name (String), and a Boolean Value (True/False) indicating whether or not to Hide the Table or Unhide it. - Sub-Routine definition:
- Public Sub HideTable(strTableName As String, blnHide As Boolean)
-
Application.SetHiddenAttribute acTable, strTableName, blnHide
-
End Sub
- Sample usage:
- 'To Hide Table1
-
Call HideTable("Table1", True)
-
-
'To Unhide Table1
-
Call HideTable("Table1", False)
- To Hide/Unhide ALL Tables excluding System and Temporary Tables:
- Dim tdf As DAO.TableDef
-
-
For Each tdf In CurrentDb.TableDefs
-
If Mid$(tdf.Name, 2, 3) <> "Sys" And Left$(tdf.Name, 1) <> "~" Then
-
Call HideTable(tdf.Name, True) 'Hide
-
'Call HideTable(tdf.Name, False) 'Unhide
-
End If
-
Next
- Some other useless code:
- Public Function fIsTableHidden(strTableName As String) As Boolean
-
fIsTableHidden = Application.GetHiddenAttribute(acTable, strTableName)
-
End Function
- Useless code usage (is that redundant?):
- If fIsTableHidden("Table1") Then
-
MsgBox "Table1 is Hidden"
-
Else
-
MsgBox "Table1 is NOT Hidden"
-
End If
i modified the code slightly and get an error, this is what i modified it to
- Function SecureTable(qLock As Boolean)
-
Dim tdf As DAO.TableDef
-
For Each tdf In CurrentDb.TableDefs
-
If Mid$(tdf.Name, 2, 3) <> "Sys" And Left$(tdf.Name, 1) <> "~" Then
-
Application.SetHiddenAttribute acTable, tdf, qLock
-
End If
-
Next
-
End Function
error is type mismatch highlighting "SetHiddenAttribute"
have i gone too far (in my ADezii MOD)?
Ahh think i got it, needed to use tdf.name on line #5
Thanks for the help
Sign in to post your reply or Sign up for a free account.
Similar topics
by: F. Da Costa |
last post by:
Following is a snippet of html in which I hide a whole table and try to
hide a single row.
Here is my question (plz don't chew my head off if its css related instead):
Why does the divTable...
|
by: mt |
last post by:
In a nutshell, I'd like to have a list of items, each of which fills out a
small table which displays some info about a particular item(the items being
a trouble ticket for a tech support ASP-built...
|
by: luvdairish |
last post by:
Can someone please look at my code and see why tables are not hiding
properly?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Untitled Document</TITLE>
<META...
|
by: luvdairish |
last post by:
I tried posting a few times, but it hasn't shown up. Hope this one
works.
Problem: Having trouble hiding tables when page is loaded.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0...
|
by: Ben |
last post by:
I have a form for data entry which is in a table. I have a select box
to enter a customer name, which takes it's options from the customer
database. I have a button to add a new customer. What I...
|
by: Amber |
last post by:
The DataGrid allows you to make columns visible or invisible on demand
- even edit and other special columns. This article will show you how
it is done.
Some developers have reported problems...
|
by: Doug |
last post by:
Looking for opinions/suggestions:
Suppose I have a "region" of an aspx page I want to hide or show based on
whatever runtime conditions. Additionally, the entire region is defined by
an HTML...
|
by: 60325 |
last post by:
This is the page where I collect the data in drop-down boxes with
values of 1-10 and send it to a submitted page to do calculations.
Example:
Employee1 TeamScore(1-10)
Employee2 ...
|
by: Severus Snape |
last post by:
I can display and hide 1 object at a time, but haven't seen it done on
multiple objects simultaneously. I have four (or more) tables on a
page that start off hidden, and I want to toggle their...
|
by: pic078 via AccessMonster.com |
last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files)
that remains stuck in task manager after exiting the application - you can't
reopen database after exiting as a result...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |