M
MChrist
The following is a code chunk that I am using to retrieve a recordset from an
MS SQL Server using a function that I created on the server. The function
returns the records fine, but it doesn't return the column headers.
I would like to use the information to create/update a pivot table directly,
without having to paste the data to the spreadsheet via the copyfromrecordset
method.
Any ideas of what I'm missing.
Thanks in advance.
Mark
Set Cnxn = New ADODB.Connection
Cnxn.ConnectionTimeout = 0
Cnxn.Open strCnxn
'SQL to call from db
Set rs = New ADODB.Recordset
strSQL = "SELECT ClientID, Client, [Desc], Tool, Amount FROM
dbo.fnMyFunction('" _
& Format(DateValue(dtStart), "mm/dd/yyyy") & "','" _
& Format(DateValue(dtEnd), "mm/dd/yyyy") & "')"
MS SQL Server using a function that I created on the server. The function
returns the records fine, but it doesn't return the column headers.
I would like to use the information to create/update a pivot table directly,
without having to paste the data to the spreadsheet via the copyfromrecordset
method.
Any ideas of what I'm missing.
Thanks in advance.
Mark
Set Cnxn = New ADODB.Connection
Cnxn.ConnectionTimeout = 0
Cnxn.Open strCnxn
'SQL to call from db
Set rs = New ADODB.Recordset
strSQL = "SELECT ClientID, Client, [Desc], Tool, Amount FROM
dbo.fnMyFunction('" _
& Format(DateValue(dtStart), "mm/dd/yyyy") & "','" _
& Format(DateValue(dtEnd), "mm/dd/yyyy") & "')"