La siguiente función oculta las tablas de la base de datos añadiendo el atributo DB_HIDDENOBJECT a cada una de las tablas:


Function OcultaDesoculta(Ocultar As Boolean) Dim Tablas As TableDef
For Each Tablas In CurrentDb.TableDefs
If Ocultar = True Then
If Not (Tablas.Attributes And DB_HIDDENOBJECT) Then
Tablas.Attributes = Tablas.Attributes + DB_HIDDENOBJECT
End If
Else
If (Tablas.Attributes And DB_HIDDENOBJECT) Then
Tablas.Attributes = Tablas.Attributes - DB_HIDDENOBJECT
End If
End If
Next
End Function

Y llama a esta funcion con el parametro False/TRUE, es decir OcultaDesoculta False, y no se verán las tablas de la base de datos ni de coña.

Fuente: accessbuho.mvps.org

La siguiente función sirve tanto para ocultar/mostrar tablas locales como vinculadas.


Public Function AWHideTable(opHIDE As Boolean) Dim tblTMP As TableDef
For Each tblTMP In CurrentDb.TableDefs
With tblTMP
If .Attributes = dbAttachedTable And opHIDE Then
.Attributes = dbHiddenObject
ElseIf .Attributes = (dbAttachedTable + dbHiddenObject) And Not opHIDE Then
.RefreshLink
ElseIf .Attributes = 0 And opHIDE Then
.Attributes = dbHiddenObject
ElseIf .Attributes = 1 And Not opHIDE Then
.Attributes = 0
End If
End With
Next
Application.RefreshDatabaseWindow
End Function
Fuente: accessbuho.mvps.org

Leave a Reply