Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.visual.basic    |    MS Visual Basic discussions, NOT dot-net    |    10,840 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 10,017 of 10,840    |
|    Steve Gerrard to Joe-Paul    |
|    Re: CrossTab Query    |
|    15 Apr 06 09:07:23    |
   
   From: mynamehere@comcast.net   
      
   "Joe-Paul" wrote in message   
   news:SYqdnbahdvoR2N3ZnZ2dnUVZ_umdnZ2d@comcast.com...   
   > Hi:   
   >   
   > I'm using a "CrossTab" Query to retrieve data. When I get it back, I want   
   > to print the column Headers along the first row of the grid. How to I get   
   > the names of the column Headers?   
      
   Any recordset, regardless of what sort of query you use to get it, will include   
   a Fields collection.   
   So something like this will get you the information you need:   
      
    Dim oRS As Recordset   
    Dim oFld As Field   
      
    ' get data into oRS...   
      
    ' The number of columns is.oRS.Fields.Count.   
    Debug.Print "columns needed: " & oRS.Fields.Count   
      
    For Each oFld In oRS.Fields   
    ' do something here with each field name   
    Debug.Print oFld.Name   
    Next oFld   
      
   Now you can play with setting up the grid and labelling the column headers...   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca