Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #14277

Re: Count columns per table

From Ron Weiner <rw@domain.com>
Newsgroups comp.databases.ms-access
Subject Re: Count columns per table
Date 2021-03-22 16:56 -0400
Organization WorksRite
Message-ID <s3b09d$9f0$1@dont-email.me> (permalink)
References <e12f6c3f-03c4-4967-a676-48c6fb707216n@googlegroups.com>

Show all headers | View raw


musicloverlch wrote :
> I've figured out how to count the number of rows in each table, but how do I 
> count the number of columns in each table? I don't want to do it table by 
> table.
>
> Thanks,
> Laura

I don't understand exactly what you are after.  But, the code below 
will iterate each table in the database and print the table name an 
number of columns in the table.  Hopefully this gets you going.

Rdub

    Dim db As DAO.Database
    Dim tdf As DAO.TableDef
    Set db = CurrentDb
    For Each tdf In db.TableDefs
        ' ignore system and temporary tables
        If Not (tdf.Name Like "MSys*" Or tdf.Name Like "~*") Then
            Debug.Print tdf.Name, tdf.Fields.count
        End If
    Next
    Set tdf = Nothing
    Set db = Nothing

-- 
This email has been checked for viruses by AVG.
https://www.avg.com

Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Count columns per table musicloverlch <lhowey@gmail.com> - 2021-03-22 10:50 -0700
  Re: Count columns per table Ron Weiner <rw@domain.com> - 2021-03-22 16:56 -0400
    Re: Count columns per table musicloverlch <lhowey@gmail.com> - 2021-03-23 06:31 -0700
      Re: Count columns per table Ron Paii <ron81pai@gmail.com> - 2021-03-24 06:11 -0700
      Re: Count columns per table Keith Tizzard <internet.shopping@foobox.com> - 2021-03-24 07:51 -0700
        Re: Count columns per table musicloverlch <lhowey@gmail.com> - 2021-05-17 14:18 -0700
          Re: Count columns per table RobertoA <amorosik@tiscalinet.it> - 2021-05-19 08:16 +0200
            Re: Count columns per table musicloverlch <lhowey@gmail.com> - 2021-05-19 06:53 -0700
              Re: Count columns per table RobertoA <amorosik@tiscalinet.it> - 2021-05-19 15:56 +0200

csiph-web