Access 2007 Property for visible tables in navigation pane?

  • Follow


I have a form with a list box. I would like the list box to load the tables 
from my database that are visible in the Navigation pane. Where is this 
property set? I have tried the AllTables collection, but the table properties 
are not available. And I tried this:

Dim cat As adox.Catalog
Set cat = New adox.Catalog

cat.ActiveConnection = CurrentProject.Connection

Dim i As Integer

With cat.Tables
    For i = 0 To (.Count - 1)
        If .Item(i).Properties(9).Value = False Then
            Me.lstTables.AddItem .Item(i).Name
        End If
    Next i
End With

Where Properties(9).name = Jet OLEDB:Table Hidden In Access
and where lstTables is my list box on my form.

This lists most of the tables because, I'm guessing, that property is for 
something else. Any thoughts?

Thank you,

Balbina
0
Reply Utf 3/22/2010 6:36:01 PM

"Balbina" <Balbina@discussions.microsoft.com> wrote in message 
news:C0A486F2-9924-4C6E-B96A-F455ECBCA2D8@microsoft.com...
>I have a form with a list box. I would like the list box to load the tables
> from my database that are visible in the Navigation pane. Where is this
> property set? I have tried the AllTables collection, but the table 
> properties
> are not available. And I tried this:
>
> Dim cat As adox.Catalog
> Set cat = New adox.Catalog
>
> cat.ActiveConnection = CurrentProject.Connection
>
> Dim i As Integer
>
> With cat.Tables
>    For i = 0 To (.Count - 1)
>        If .Item(i).Properties(9).Value = False Then
>            Me.lstTables.AddItem .Item(i).Name
>        End If
>    Next i
> End With
>
> Where Properties(9).name = Jet OLEDB:Table Hidden In Access
> and where lstTables is my list box on my form.
>
> This lists most of the tables because, I'm guessing, that property is for
> something else. Any thoughts?
>
> Thank you,
>
> Balbina


You can use the Application.GetHiddenAttribute method to find out whether a 
particular table's Hidden attribute is set.  For example:

'------ start of example code ------
    Dim ao As AccessObject

    For Each ao In CurrentData.AllTables
        If ao.Name Like "MSys*" Then
            ' skip system tables
        Else
            If Application.GetHiddenAttribute(acTable, ao.Name) = False Then
                Me.lstTables.AddItem ao.Name
            End If
        End If
    Next ao
'------ end of example code ------


-- 
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

0
Reply Dirk 3/22/2010 7:06:58 PM


Thank you for the suggestion, unfortunately, it does not catch user defined 
hidden tables. For example, I have designated "Switchboard Items" to be 
'Hidden in this Group' but its GetHiddenAttribute property is still False.

Balbina

"Dirk Goldgar" wrote:

> "Balbina" <Balbina@discussions.microsoft.com> wrote in message 
> news:C0A486F2-9924-4C6E-B96A-F455ECBCA2D8@microsoft.com...
> >I have a form with a list box. I would like the list box to load the tables
> > from my database that are visible in the Navigation pane. Where is this
> > property set? I have tried the AllTables collection, but the table 
> > properties
> > are not available. And I tried this:
> >
> > Dim cat As adox.Catalog
> > Set cat = New adox.Catalog
> >
> > cat.ActiveConnection = CurrentProject.Connection
> >
> > Dim i As Integer
> >
> > With cat.Tables
> >    For i = 0 To (.Count - 1)
> >        If .Item(i).Properties(9).Value = False Then
> >            Me.lstTables.AddItem .Item(i).Name
> >        End If
> >    Next i
> > End With
> >
> > Where Properties(9).name = Jet OLEDB:Table Hidden In Access
> > and where lstTables is my list box on my form.
> >
> > This lists most of the tables because, I'm guessing, that property is for
> > something else. Any thoughts?
> >
> > Thank you,
> >
> > Balbina
> 
> 
> You can use the Application.GetHiddenAttribute method to find out whether a 
> particular table's Hidden attribute is set.  For example:
> 
> '------ start of example code ------
>     Dim ao As AccessObject
> 
>     For Each ao In CurrentData.AllTables
>         If ao.Name Like "MSys*" Then
>             ' skip system tables
>         Else
>             If Application.GetHiddenAttribute(acTable, ao.Name) = False Then
>                 Me.lstTables.AddItem ao.Name
>             End If
>         End If
>     Next ao
> '------ end of example code ------
> 
> 
> -- 
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
> 
> (please reply to the newsgroup)
> 
0
Reply Utf 3/22/2010 7:26:01 PM

2 Replies
567 Views

(page loaded in 0.067 seconds)


Reply: