VB and Crystal Reports

Im trying to bind a crystal report to a database using a data control. Ive done this before with no problems, but in this case the database has two tables. Im trying to bind info out of both tables. You cant do that using one data control. In the crystal reports data source property you can only specify one data control. This has been driving me nuts, there has to be a way to do it.......Please help




Comments

  • Instead of binding the report to the data control

    at design time you should write a SQL statement

    which has all the columns you require from both the tables

    and use this SQL statement to open the resultset.


    Dim dbs as Database


    Set dbs = OpenDatabase(" ")-- path of the database


    ls_sql = " SELECT A.EMPLOYEE_CD,B.DEPT_DESC FROM EMPLOYEE A,DEPT B "

    ls_sql = ls_sql & " WHERE B.EMPLOYEE_CD = A.EMPLOYEE_CD "


    SET DataControl1.Recordset = dbs.OpenRecordset(ls_sql,DBOpenDynaset)


    Bind the Crystal report control to the data control.







Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories