Finding Number of fields in a Recordset/Table

benti

New member
Local time
Today, 13:54
Joined
Aug 11, 2004
Messages
8
I'm creating a Graph based on a tmp table with a unknown number of Fields, and seaching for a function to find the total number of Fields directly in the Table or by using a Recordset.
 
Benti,

At the least, you can use a function like DCount to count them:

HowMany = DCount("[SomeField]", "SomeTable", "[SomeCriteria] = " & Me.SomeCriteria)

Wayne
 
Or you can use
Code:
myRecordset.Fields.Count
 
WayneRyan said:
Benti,

At the least, you can use a function like DCount to count them:

HowMany = DCount("[SomeField]", "SomeTable", "[SomeCriteria] = " & Me.SomeCriteria)

Wayne


I think this returns the number of records in a given field where the search condition (criteria) exists/is true.

I'd use Chris's way or you can manually do the same thing as chris

Code:
Dim lngCount As Long
lngCount = 0
For Each fld in rs.Fields
    lngCount = lngCount + 1
Next
rs is your recordset variable and fld is a recordset field variable
 
This was what I looked for.
Thanks a lot to you all!
 

Users who are viewing this thread

Back
Top Bottom