Hi All

I am facing a issue. I have a excel file developed in excel 2003 which is working fine. We want to migrate it to 2007. After doing that stored procedure which is used to be called from the macro is not working. Stored procedure take 3 input arguments and returns a ref cursor.
DBO.bead_dq_pf_d(currentDate,previousDate, String,ref cursor)

Dim connection As ADODB.connection
Dim command As New ADODB.command
Dim Recordset As New ADODB.Recordset

command.ActiveConnection = connection
command.CommandText = "DBO.bead_dq_pf_d(to_date('" & StrCurrentDt & "','yyyymmdd'), to_date('" & StrPreviousDt & "','yyyymmdd'), " & Str_LV_ID & ", '" & Range("invGFCID") & "')"

'For Error Log
ThisWorkbook.Sheets("ErrorLog").Range("QueryExecuted") = ""
ThisWorkbook.Sheets("ErrorLog").Range("QueryExecuted") = command.CommandText
Recordset.Open command

ThisWorkbook.Worksheets("3c. Counterparty Portfolio View").Activate
Set RangeCounterpartyPortfolio = Range("byCounterpartyPortfolio")
RangeCounterpartyPortfolio.CopyFromRecordset Recordset

Recordset.Close

I am getting invalid sql error. I tried multiple ways to make it work but in vain.
Can anyone give an working example. I would greatly appreciate your help.