Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7653315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:00:06+00:00 2026-05-31T12:00:06+00:00

I am trying to iterate through the fields on each recordset and have their

  • 0

I am trying to iterate through the fields on each recordset and have their values added to my Excel 2007 worksheet.

I have the following code, but I am getting “Object doesn’t support this property” whenever it reaches “For Each x In..”
Am I missing something ? Do I need to add additional references in VBA to use .Fields? I am currently using Microsoft ActiveX Data Objects 6.0 Library on my references. The SQL queries an Oracle Database, but I don’t suppose that matters in this error.

Set recSet = newConn.getOpenIncidents("exampleworkgroup")
Set Path = ThisWorkbook.Worksheets("Incidents")
iRow = 2

With Path
    iCol = 1
    For Each x In recSet.Fields
        .Cells(iRow, iCol).Value = x.Value  'Customer Name
        iCol = iCol + 1
    Next
End With 

And this is the code for the function in my class

Public Function getOpenIncidents(ByVal wrkgp As String)
    Set rs = New ADODB.Recordset
    Dim SQL As String

    SQL = "SELECT intbl.cust_ky, intbl.incid_id, intbl.OPEN_TS, intbl.CLOSE_TS, wrkgptbl.wrkgp_id, intbl.incid_ttl_dn " _
        & "FROM (MAIN.testtable intbl INNER JOIN MAIN.wrkgrp wrkgptbl ON intbl.curr_wrkgp_ky=wrkgptbl.wrkgp_ky) " _
        & "WHERE wrkgptbl.wrkgp_id='" & wrkgp & "'"

    rs.Open SQL, con, adOpenKeyset
    rs.MoveFirst
    getOpenIncidents = rs

End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:00:08+00:00Added an answer on May 31, 2026 at 12:00 pm

    I think I’ve spotted it! recSet is actually of type Fields. as such there is no such .Fields property as .Fields is a property of a Recordset Object.

    The fix should be:

    For Each x In recSet
    

    Or change the getOpenIncidents() method to return a RecordSet (including changing the return line to Set getOpenIncidents = rs).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to iterate through an array of elements. jQuery's documentation says: jquery.Each() documentation
I'm trying to iterate through a JSON response that's generated from my code-behind. The
I am trying to iterate through a list and take each part of the
I'm trying to iterate through each line of a multiline textbox. Something like: For
I am trying to iterate through each of the members of an object. For
I am trying to iterate through each web and its webs, to get the
I am trying to iterate through a table using the jquery .each function as
I am trying to iterate through a number .rtf files and for each file:
I am trying to iterate through form.fields in a template and for: {% for
I am trying to iterate through the SPListItem.Versions collection to find the latest approved

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.