Field Count in a recordset?

  • Thread starter Thread starter BlueWolverine
  • Start date Start date
B

BlueWolverine

Hey,
MS ACCESS 2003 on XP PRO.

How can I get the # of fields in a recordset?

I know I can do rs.recordcount to get the number of records, but how do I
get the number of fields?
 
By looking into Fields collection and querying its Count property.

Assuming rs is a Recorset object variable:

rs.Fields.Count
 
BlueWolverine said:
Hey,
MS ACCESS 2003 on XP PRO.

How can I get the # of fields in a recordset?

I know I can do rs.recordcount to get the number of records, but how do I
get the number of fields?


Have you considered

rs.Fields.Count

?
 
Thank you. I feel like a moron but that makes sense. I usually only use
rs.fields(x).value out of .fields but rs.fields.count should've occurred to
me as something to try immediately. Thank you.
 
No need to feel like a moron. It may not be immediately obvious but it
should be noted that collections can have its set of methods &
properties that are distinct from members' methods & properties.

Sometime I have to be explicitly aware of something to know about it &
make use of it. Sometime I get lucky and figure/guess/stumble upon it. :)
 
Thank you. I feel like a moron but that makes sense.

I once came in here asking for a way to tell how many lines tall the text
for a control could be given the width of the control, the format of the text
and the amount of text that was in the control. I had searched the web,
Leban's site, all the places I thought I might find the info required...

My intent was to programmatically collect this information, and resize a
textbox control on a report if it needed to be bigger to show everything.


The replies were along these lines:

"Won't the .CanGrow property do that for you?"

Doh! Didn't even know it existed!


--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
Back
Top