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

loading new report to report viewer

Status
Not open for further replies.

REDYPS

Programmer
Jun 12, 2003
12
US
Here's what I want to do in my application. I have a form where a user is allowed to pick parameters for a query which I want to use to create a report.

On the load form event I have code which creates a default report of all records in the sql view. When I reset the dataset all goes well. The dataset clears and fills just fine. The problem is when I try to reset the report document data source and display the report with the new data.

If I create a new report document via code and use the load method I get "Load Report Failed"

If I use the existing report document I get a prompt for user id, password etc to connect to the database. However the same code on the load form event doesn't prompt for this information.

I've posted both code pieces below.... Any thoughts??

'Load Form event (works fine)
SqlSelectCommand1.CommandText = strSQL1 'command
sdaReport.Fill(dsReport) 'dataadapter
docTemp.SetDataSource(sdaReport) 'reportdocument
crvChecks.ReportSource = docTemp 'crystal report viewer

'Report Change (doesn't work)
SqlSelectCommand1.CommandText = strSQL1
dsReport.Clear()
sdaReport.Fill(dsReport)
docTemp.Load("rptChecks.rpt") 'fails here
docTemp.SetDataSource(sdaReport)
crvChecks.ReportSource = docTemp

The crystal report is included in the .exe and created dynamically at run time.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top