Solved

Crystal report in SQL

Posted on 1998-08-05
3
139 Views
Last Modified: 2010-05-03
i would like to print out the report according to the query below, the table name is "table", field is "id" and search for the word "test", if found then print out the report. but i've tried the following code it printed out all the report. why ?

CrystalReport1.SQLQuery = "SELECT * FROM table WHERE id = 'test'"
0
Comment
Question by:qazwsxedc
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
percosolator earned 10 total points
ID: 1467967
If you are still attaching to Access like in your last question, it won't work.  SQLQuery is for attaching to a SQL Server.

One alternative is to create a stored Access query with a parameter field to pass in.


0
 

Author Comment

by:qazwsxedc
ID: 1467968
you meant SQLquery just for SQLserver usage ? if then how the alternative ways work that you talking about ?
0
 
LVL 2

Expert Comment

by:percosolator
ID: 1467969
don't know if it's only MS SQL server, probably not, more than likely it will work with another SQL server, Oracle or some other.

If you know how to create an Access query, you can do several things:  create the query to show all of the critical fields and attach Crystal to that query, and then pass a filter to crystal using the filter property like I showed you in the other question (which is probably your best route, since it's simplest)

Or create a temporary table in Access, create two action queries (one to delete all records in the table, and the other to populate the table with your desired data by passing a parameter to it) and linking crystal to that temporary table.  This method is more involved and has more steps, but is quicker to generate the report and depends on what, exacltly you are doing, how many stages the data has to go through, and (of course) how many records you are dealing with.

If you aren't talking 1000's of records, or your data doesn't have to be staged, or transformed, then I would recommend the first method.

P.S.  How do you pronounce "qazwsxedc"?  Thought mine was bad <g>.
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question