number of columns in table

  • Thread starter Thread starter arista via AccessMonster.com
  • Start date Start date
A

arista via AccessMonster.com

Hi
I would like to count number of columns in some table. I think it should be
possible with ADOX (columns object) but if not necessary I do not want to
include this reference into my code.
Would it be possible to count the number of columns by some SQL command for
example?
Or perhaps create an array of variant, then assign entire record (e.g. first
row from the table) to this array and finally count the fields in this array ?

Or use somehow object field ?
The number of columns is changing in my table and I need to make further code
accordingly.
Thanks
Ari
 
Well, well Ari
I found few minutes afterwards the answer and just hoping it works correctly.

Dim TableSet As New ADODB.Recordset
Dim x As Long

TableSet.Open "tblTemp_v9_CutterStatistics", CurrentProject.Connection,
adOpenDynamic, adLockOptimistic

x = TableSet.Fields.Count

TableSet.Close

Rgs
Ari
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top