Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2005
    Posts
    183

    Unanswered: Recordset to columns

    As you can see form the below code, I fetch a recordset based on a ADO command. Then I count the amount of fields (columns) in that result in order to feed the data into each of the columns next to the one where the command related to this code is invoked.

    I just can't seem to get an insert line to use the address created by the activecell offset line.

    Any ideas?

    /Trin

    Code:
        Set GIDrs = kommando.Execute
        For i = 0 To GIDrs.Fields.Count
            aktuel2 = ActiveCell.Offset(0, (i + 1)).Address
            <some insert line based on aktuel2 address>
    
        Next i
    IT squid: networks, servers, firewalls, routers and I dabble a little with SQL-server and Access as well....

  2. #2
    Join Date
    Oct 2005
    Posts
    183
    Slight change in code seems to get me closer to the target, but doesn't work either..

    Code:
        For i = 0 To GIDrs.Fields.Count
            ActiveCell.Offset(0, (i + 2)).Activate
            ActiveCell.Value = GIDrs.Fields(i).Value
        Next i
    IT squid: networks, servers, firewalls, routers and I dabble a little with SQL-server and Access as well....

  3. #3
    Join Date
    Mar 2006
    Posts
    163
    I don't see anything in that code involving a recordset.

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    You do not say what actually happens ??

    Does the recordset contain any records ? (recordcount > 0 or GISrs.EOF=False)

    Try writing the field names to see if that produces any output ie

    Code:
        For i = 0 To GIDrs.Fields.Count-1
            ActiveCell.Offset(0, (i + 2))=GIDrs.Fields(i).Name
        Next i

    note: GIDrs.Fields.Count-1 ???


    MTB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •