If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Recordset to columns

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-30-07, 02:44
Trinsan Trinsan is offline
Registered User
 
Join Date: Oct 2005
Posts: 168
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....
Reply With Quote
  #2 (permalink)  
Old 03-30-07, 03:28
Trinsan Trinsan is offline
Registered User
 
Join Date: Oct 2005
Posts: 168
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....
Reply With Quote
  #3 (permalink)  
Old 03-30-07, 07:42
norie norie is offline
Registered User
 
Join Date: Mar 2006
Posts: 163
I don't see anything in that code involving a recordset.
Reply With Quote
  #4 (permalink)  
Old 03-30-07, 08:25
MikeTheBike MikeTheBike is offline
Registered User
 
Join Date: Apr 2004
Location: Derbyshire, UK
Posts: 714
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On