如何计算表中的字段数? [英] How to count number of fields in a table?
本文介绍了如何计算表中的字段数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试计算Access 2010中表中的字段数.我需要vb脚本吗?
I am trying to count number of fields in a table in Access 2010. Do I need a vb script?
推荐答案
您可以从TableDef
Fields
集合的.Count
属性中检索表中的字段数.这是即时窗口示例( Ctrl + g 将带您到那里)...
You can retrieve the number of fields in a table from the .Count
property of the TableDef
Fields
collection. Here is an Immediate window example (Ctrl+g will take you there) ...
? CurrentDb.TableDefs("tblFoo").Fields.Count
13
如果实际上是要用行数代替字段数,则可以使用TableDef
RecordCount
属性或DCount
.
If you actually meant the number of rows instead of fields, you can use the TableDef
RecordCount
property or DCount
.
? CurrentDb.TableDefs("tblFoo").RecordCount
11
? DCount("*", "tblFoo")
11
这篇关于如何计算表中的字段数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文