Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic data source ( Pervasive ODBC) to Crystal Report

Status
Not open for further replies.

anhnguyen1999

Programmer
Apr 22, 2002
5
US
I need to create a report (Crystal Report) which my data source is a recordset that I got after call OpenResultset(sSQL).
My sSQL is actually different each time depend on what report I run.
How can I add that recordset to be my data source and use it in my report?

'************************************

Private Sub Form_Load()
Dim sSQL As String
Dim rdoTest As rdoResultset
Dim en As rdoEnvironment
Dim conn As String

Set en = rdoEnvironments(0)
conn = "DRIVER={Pervasive ODBC Engine Interface};" _
& "DATAPATH=c:\Mydata;" & "DDFPATH=c:\Mydata;" _
& "ACCESSFRIENDLY=yes;"

Set cn = en.OpenConnection(dsName:="Mydata", _
Prompt:=rdDriverComplete, _
Connect:=conn)

sSQL = "SELECT Departments.Department, Departments.DeptCode, INVENTORY.Description, INVENTORY.ItemID
FROM (Departments INNER JOIN IVENTORY ON Departments.DeptCode = INVENTRY.DeptCode)

Set rdoTest = cn.OpenResultset(sSQL)

' Can I use this line below and in my Crystal report at
' design time I will add data source chosing ODBC -> RDO
' ->SQL and build a temp table.
Report.Database.SetDataSource rdoTest, 3, 1
End Sub

'*****************************

Thanks for any input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top