G
Guest
I'm building a recordset based on a table created by a transfer of an Excel
spread sheet . After the table has been created (and populated), I do the
following:
Dim con As Object
Dim rsImportedData As Object
Set con = Application.CurrentProject.Connection
Set rsImportedData = CreateObject("ADODB.recordset")
strSQL = "SELECT * FROM tblImportedData"
rsImportedData.Open strSQL, con, 1
idxi = rsImportedData.RecordCount
idxj = rsImportedData.Fields.Count
This places the record count in idxi and the field count in idxj (which turn
out to be 1114 and 9, repectively)
Now I want to get the field names and I try:
strFieldName =rsImportedData.fields.Item_1.Name
or
strFieldName =rsImportedData.fields.[Item 1].Name
which doesn't work. errormessage:
<Object doesn't support this property or method>
What is the correct syntax here?
And is there a better way of capturing table field names?
Thanks,
Jael
spread sheet . After the table has been created (and populated), I do the
following:
Dim con As Object
Dim rsImportedData As Object
Set con = Application.CurrentProject.Connection
Set rsImportedData = CreateObject("ADODB.recordset")
strSQL = "SELECT * FROM tblImportedData"
rsImportedData.Open strSQL, con, 1
idxi = rsImportedData.RecordCount
idxj = rsImportedData.Fields.Count
This places the record count in idxi and the field count in idxj (which turn
out to be 1114 and 9, repectively)
Now I want to get the field names and I try:
strFieldName =rsImportedData.fields.Item_1.Name
or
strFieldName =rsImportedData.fields.[Item 1].Name
which doesn't work. errormessage:
<Object doesn't support this property or method>
What is the correct syntax here?
And is there a better way of capturing table field names?
Thanks,
Jael