Finding Number of fields in a Recordset/Table (1 Viewer)

benti

New member
Local time
Today, 04:21
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.
 

WayneRyan

AWF VIP
Local time
Today, 03:21
Joined
Nov 19, 2002
Messages
7,122
Benti,

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

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

Wayne
 

tkpstock

Cubicle Warrior
Local time
Yesterday, 22:21
Joined
Feb 25, 2005
Messages
206
Or you can use
Code:
myRecordset.Fields.Count
 

modest

Registered User.
Local time
Yesterday, 22:21
Joined
Jan 4, 2005
Messages
1,220
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
 

benti

New member
Local time
Today, 04:21
Joined
Aug 11, 2004
Messages
8
This was what I looked for.
Thanks a lot to you all!
 

Users who are viewing this thread

Top Bottom