Hello everybody

I am trying to pass a recordset to Crystal report using a TTX file. The recordset is created by executing Stored procedure. I created the TTX file from the recordset, using the Active Driver Function CreateFieldDefFile(). but when i run the code the report does not get populated with the records. I am SQL Server2000 as the database. What am I doing wrong here? Please advise.

Thanks in advance



Dim CrAppl As New CRPEAuto.Application
Dim CrRep As CRPEAuto.Report
Dim CrDB As CRPEAuto.Database
Dim CrTables As CRPEAuto.DatabaseTables
Dim CrTable As CRPEAuto.DatabaseTable

Private Sub UserForm_Activate()
Dim oRSRate As New ADODB.Recordset
Dim oCmd As New ADODB.Command
Dim oParam As New ADODB.Parameter
Dim oConn As New ADODB.Connection
Dim sStr As String

oConn.Open sConn
Set oCmd.ActiveConnection = oConn
oCmd.CommandText = "sp_get_total_qty_rate"
oCmd.CommandType = adCmdStoredProc
Set oParam = oCmd.CreateParameter("customerid", adChar, adParamInput, 15, "AI")
oCmd.Parameters.Append oParam
Set oParam = oCmd.CreateParameter("datefrom", adDate, adParamInput, , "2003/01/01")
oCmd.Parameters.Append oParam
Set oParam = oCmd.CreateParameter("dateto", adDate, adParamInput, , "2003/01/20")
oCmd.Parameters.Append oParam


'open the ADO recordset
oRSRate.Open oCmd, , adOpenDynamic, adLockBatchOptimistic
'open the report
Set CrRep = CrAppl.OpenReport("D:\Report1.rpt")
'set the database object to the reports database
Set CrDB = CrRep.Database
'set the databaseTables object
Set CrTables = CrDB.Tables
'set the databaseTable object to the first table in the report
Set CrTable = CrTables.Item(1)
'sets our ADO recordset as the data for the first table
CrTable.SetPrivateData 3, oRSRate
'Preview the report with the ADO recordset as the data
CrRep.Preview

oRSRate.Close
End Sub