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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Number of fields in recordset

Status
Not open for further replies.

ddrandy

Programmer
May 14, 2003
11
US
I have connected to an access database and I would like to contruct an update statement into another database. Without specifing the specific fields, I would like to user the fields attribute to get the name of the field (rec.fields(0).name) and the value (rec.fields(0)). My question is, How do I know how many fields are in my table so I can create a loop to do this?

Thanks
 
using ADO
dim rs as recordset
...

rs.fields.count will give you the number of fields.

you can then loop through the fields

for i = 1 to rs.fields.count (maybe zero based)
s = rs.fields(i).value
name = rs.fields(i).name
next i

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top