LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 441
Default ADO cloned recordset doesn't return field names

I am using Windows XP with Office 2003; Microsoft ActiveX Data Objects 2.8
Library;

I am using the following function to execute an ADO query. It works great,
but it doesn't return the field names. How can I get it to do that?

Public Function ADOReturnDisconnectedRecordset(argConnection As String,
argSQL As String) As ADODB.Recordset
'RETURNS A DISCONNECTED ADO RECORDSET TO THE CALLING SUBROUTINE OR FUNCTION
Dim cnADO As ADODB.Connection
Dim rsADO As ADODB.Recordset
Set cnADO = New ADODB.Connection
cnADO.CursorLocation = adUseClient
cnADO.ConnectionString = argConnection
cnADO.CommandTimeout = 0 'NO TIMEOUT
cnADO.Open
Set rsADO = New ADODB.Recordset
rsADO.MaxRecords = 0 '0 = ALL RECORDS
Set rsADO = cnADO.Execute(argSQL)
Set rsADO.ActiveConnection = Nothing 'SEVER CONNECTION
Set ADOReturnDisconnectedRecordset = rsADO.Clone(adLockReadOnly) 'RETURN
CLONE
If rsADO.State = adStateOpen Then rsADO.Close
Set rsADO = Nothing
cnADO.Close
Set cnADO = Nothing
End Function

Please include the correcting line(s). Thanks much in advance.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
return recordset Laurent M Excel Discussion (Misc queries) 4 January 26th 05 09:43 AM
ActiveX CommandButton gets renamed when Sheet is cloned running Excel97 JimP Excel Programming 1 December 28th 04 02:32 PM
UserForm problem when Worksheet is cloned JimP Excel Programming 1 November 18th 04 02:52 AM
return all worksheet tab names and chart sheet tab names in report - an example DataFreakFromUtah Excel Programming 2 October 6th 04 08:09 PM
DAO query/recordset returns with field names Seth[_4_] Excel Programming 0 August 18th 03 08:36 PM


All times are GMT +1. The time now is 05:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"