getting fields from a unknown Recordset

M

Mirco Wilhelm

The called function below returns a ADODB.Recordset, but I don't know the
fieldnames.

Is there a way to get them?
___________________________________________________________
Sub testGetRSFromExcel()

Dim srcExcelRecordSet As New ADODB.Recordset
Set srcExcelRecordSet = GetRSFromExcel("test.xls", "A1", "C10", 1)

End Sub
___________________________________________________________
 
B

Bogdan Zamfir

Hi,

Add the folowing code:

dim fld as ADODB.Field
For Each fld In rs.Fields
Debug.Print fld.Name
Next

With this code, you can get all other properties of the fields, like type,
etc.

HTH,
Bogdan

_______________________________
Freelance programmer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top