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

How to add SQL query in the Report?

Status
Not open for further replies.

knzy

Programmer
Jan 25, 2002
63
CA
I've created a SQL query in SQL desinger, but couldn't add it or use its fields in the report. What can I do next? Thanks in advance.
 
Create a New Standard Report. In the Data Explorer dialog, expand the Query/Metadata node and click on Crystal SQL Query Files.

You should get a "File Open" common dialog box. Navigate to the folder where your .qry file is (preferably, this should be the same folder where you will save your .rpt file). Select your .qry file and click the "Open" button. This closes the common dialog.

Back in the Data Explorer, your .qry file should now be appended to the Crystal SQL Query Files node. Select it and click the "Add" button. You may be prompted here to connect to the database your .qry file uses, if you are not already logged in. Do that. Now, click the "Close" button of the Data Explorer.

You are now back in the Standard Report Expert. The Tables Available listbox should show the word "Query". Do NOT try to add tables or other queries to this list - a query report cannot link to other data sources.

Click the Fields tab. The Available Fields listbox shows your query and its fields. From here on, design your report just as you would with a table-based report.
 
Thanks Rogar!

I know it looks like a basic question. The problem is that after I open the .qry file and click the 'ADD' button in the data explorer, nothing happened. I couldn't add it to the Tables Avaliable listbox.

I had to create a new query file from scratch, and it works.

Is it a bug in CR?
 
Sounds more like a problem with your query file. Or possibly you did not have a database connection. You weren't trying to add the query to a report with tables or another query already in the Tables Available, were you? You can't (or at least shouldn't) do that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top