+ Reply to Thread
Results 1 to 5 of 5

Get recordset without the headers

  1. #1
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Get recordset without the headers

    Hi all,

    I use the below code to connect to a database and get the data into excel sheet. I wanted to get the recordset without the headers, but I simply can't find out how to do it. 2 hours of google did not give me any results.
    Is there actually a way to do this with the below example?

    Greetings.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Get recordset without the headers

    Set the FieldNames parameter of the Querytable False.

    Or, as you already have the recordset open, rather than adding a QueryTable, use the Copyfromrecordset method in the first cell of the destination

    Please Login or Register  to view this content.
    Last edited by cytop; 05-14-2016 at 02:32 AM.

  3. #3
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Get recordset without the headers

    Hi Cytop,

    Thanks a lot, it really works :-)
    Sily me I did not see the field names in the code and to set it to false :-(

    In the above example, I use it on an Access database, but in actual work, I use it to connect to a Teradata database. When I created the solution after recording a macro and getting to know more or less how it would look like, I never managed more than the above code.

    Will it work faster if I dont create the Query Table as in the above code and use your solution?

    Greetings.

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Get recordset without the headers

    Probably not noticeably faster, but it is simpler, there's less metadata in the workbook as the Querytable information will not need to be stored, also as you've set it to not update automatically it's a level of complication removed.

    Reducing the complexity of a workbook is never a bad thing...
    Last edited by cytop; 05-14-2016 at 04:01 AM.

  5. #5
    Forum Contributor
    Join Date
    08-02-2012
    Location
    Austria
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Get recordset without the headers

    BIG THANKS, you are always a very helpful person :-)

    Greetings,

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 02-03-2016, 02:33 AM
  2. Open another recordset within current recordset vba
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-02-2015, 04:32 AM
  3. [SOLVED] How to Copy a filter data with headers, excluding the headers?
    By Elomaldo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-16-2014, 03:35 PM
  4. Replies: 4
    Last Post: 02-08-2014, 02:31 PM
  5. Replies: 2
    Last Post: 05-09-2012, 01:30 PM
  6. Replies: 3
    Last Post: 09-30-2010, 12:30 PM
  7. [SOLVED] Recordset's RowID as part of Recordset
    By Trip in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2005, 06:55 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1