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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Recordset from multiple tables

Status
Not open for further replies.

kellytim

Programmer
Oct 28, 2004
10
US
First of all, I am very new to Crystal Reports, so please bear with my ignorance of it's functionality. I have a CR10 report called from VB. I have an ADO Recordset that is populated with an SQL statement:

select serial_number, latest_status, action_date from main_table, action_table

In the sql, the serial_number and latest_status come from the main_table and the action_date comes from the action_table.

In my report, I created an ADO connection to the server to get the fields to place on my report. If I only select the main table, my report is populated from my recordset correctly. If I try to add the action_table in my report, I get a login failed, null password given error.

I was wondering if there is anyway to get the report to just accept the recordset data for the action_table field without trying to log on to the server.

Thanks for any help

kellytim
 
You can create a .ttx file, use it for the report's data source, then send a recordset to the report at runtime.

In the Database Expert, browse to 'Create New Connection' > Field Definitions Only > Create File > define your field names, datatypes, and when you're finished, it'll ask you to save the file, and should automatically add it to the report. The name of the file will become the report's 'Table', and you should be able to add it just as it were a regular table.

From VB, after you build your recordset, you can use the DatabaseTable object's SetDataSoure method to populate the report:
Report.DiscardSavedData
Report.Database.Tables(1).SetDataSource yourRecordset

-dave
 
virdu,
Thanks for the info. I appreciate the help.

Though, I really am trying to stay away from ttx files, if I can help it. I am adding reports to an existing project and trying to stay consistent. The existing project uses the database tables on the server to get it's fields, but the recordset to populate the data.

If that's the only or best way, I may consider it.


Thanks,
kellytim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top