getting fields from a unknown Recordset

  • Thread starter Thread starter Mirco Wilhelm
  • Start date Start date
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
___________________________________________________________
 
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
 
Back
Top