Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count of columns/fields in a query or table.

Status
Not open for further replies.

weightinwildcat

Programmer
May 11, 2010
84
US
Here is a quick question. If I run a query or open a table, how do I get a count of the number of fields, as opposed to the number of records?
 
msgbox NumberFields("MyTable")

Public Function NumberFields(Domain As String) As Integer
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset(Domain)
NumberFields = rs.Fields.Count
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top