Solved

Crystal report in SQL

Posted on 1998-08-05
3
140 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

856 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