Wise Owl Answers - How do I get the column names from an ADO recordset?

preview_player
Показать описание


When you copy data from a recordset into an Excel worksheet you don't get the column headings by default. This video shows you two ways to loop through the Fields collection and write out the Name property of each Field object into the worksheet.

Chapters
00:00 The Question
02:09 Counting Through the Fields Collection
03:48 Referring to a Field Object
05:33 Writing Names into the Worksheet
06:40 Using a For Each Loop
09:22 Why Doesn't the Field Class Appear?
13:37 Writing Names into the Worksheet
14:36 Selecting Specific Columns
15:34 Discovering the Column Names in a Workbook

Рекомендации по теме
Комментарии
Автор

It's Mark again. I'm speechless. Can't stop wondering how brilliant you are.

MyAudioBookCompilation
Автор

Thanks Andrew. Learned about clicking CTRL + i today (thanks... did not know that). Great video as always.

krn
Автор

Thank you very much for these amazing and useful tutorials.

KhalilYasser
Автор

Thank you so much for the amazing content. I tried to find funny videos on Twilight Movies. The Pitch Meeting Video is the best one I found so far. If I find any new ones I will send them your way.

tejamarneni
Автор

Thank you for the very informative and useful video.

RohithKK-uhpp
Автор

Thanks, Andrew

For another nugget of knowledge. The interesting parts to me in this video were the hidden elements of the library and the Shcemecolumns. I am not sure if you have something like creating the Query string from the criteria cells on the sheet. If not can you please create a video on this i.e. SELECT clause to be taken from some range (dynamic named range maybe) and also OR or AND operators from sheet and WHERE clause from some criteria cells as well.? Hope my question makes sense.

Best Regards

Imran Bhatti

imranbhatti
Автор

Request for the WiseOwl treatment: Integrating addin (.xlam) to the ribbon menu for a more professional look and natural interface. I’ve got older addins that stitch themselves into the commandbar and whilst they are still useable via legacy support the results aren’t pretty.

brencostigan
Автор

Thank you Andrew for a great tutorial it was however very short just when I started enjoying it 😀, this weekend I watched your whole VBA series, much better than Twilight 🤭, just something I haven't tried unsuccessful, is it possible to replace the Sheet$ with a variable of a specific Range on the Sheet,
Thank you for great informative tutorials 👍

frikduplessis
Автор

Dear Andrew, even if it is a bit cheeky: would it be possible to add another video to your fantastic ADO series? For me it would be a great help to understand the best practice to get several informations from closed workbook. F. I.: what if you grab one time all james bond movies and in another second (maybe from an input box or a user form) all twilight monies. And so on. Open a new connection for each genre? Or one connection and several recordsets? Or even several sub recordeds from one main 'select * from... ' recordset? This would be huge help for deeper understanding! Tell me afterwards how many cups of tea do you drunk during the editing. Thanks a ton from Bonn

thwbn
Автор

Hii Andrew !! Is it possible to loop through a Range of values using VBA for Find function
Example : Cells.Find What:="Lucky"
If found select the cell
If not found then
Cells.Find What:="Andrew"
If found, select the cell
Something like this.
P.S. I can provide a column reference to VBA to loop through

luvlycan
Автор

My result no header colum name. This is code, I don’t know what’s wrong here?
StrQuery = "select wonum as [Work Order], description AS [WO Desc], location AS [WO Loc], assetnum AS [Asset], workorder.owner AS [Owner], status, schedstart from workorder where siteid='3003' AND location LIKE '2%' AND status='APPR' AND schedstart = '2021-11-05 06:00:00'"

CuongNguyen-pfel
Автор

Hi Andrew, I have done so many dry-eyes google searches to add headers to the listbox. But all they said it not possible with ADO. So I ended up creating another listbox to just hold the headers. Do we have way to do this with listbox?

sokcheaheng
Автор

Hey Andrew - I am not sure if you did a video where you write to a closed work book.if you did, can you send me the link..Also, can you connect to a website that requires a username and password such as google sheets

wayneking
Автор

Question: is it possible to use these SQL statements to access data in an Excel file stored on SharePoint? I have used the below listed "Connection.String" which opens and closes ok but I cannot open the record set without getting an error.

& myFilePath & ";LIST={" & myListData & "};"

gerettkindred
Автор

How to get unique column name from multiple workbooks

hajajahirhussain