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

CRViewer SQL Anomaly !!!

Status
Not open for further replies.

aldur

IS-IT--Management
May 9, 2002
4
US
HELP! Please! I have tried and tried...

Can anyone tell me what is rong here? When I view the report I get the ENTIRE DB, not just the data I am requesting in my SQL (below).

NOTES:
* Example of STRING strRST = SELECT Title, Artist, OrderNo FROM [prosingdata] WHERE [Title] LIKE "*score*" ORDER BY Title, Artist, OrderNo ;

* strCReport = "f:\apps\ssearch\ssearch2.rpt"


Dim crxApp As New CRAXDRT.Application
Dim Report As CRAXDRT.Report
Set Report = crxApp.OpenReport(strCReport, 1)

'set the reportsource
CRViewer1.ReportSource = Report

'set SQL select for report
Report.SQLQueryString = strRST

'preview the report
CRViewer1.ViewReport


What am I doing wrong? All I want is the report to come up with the data shown that was selected. Instead ALL records are coming up in the report.


 
It may be your SQL, not knowing which database, I may be wrong:

Change the * to %:

SELECT Title, Artist, OrderNo FROM [prosingdata] WHERE [Title] LIKE "%score%" ORDER BY Title, Artist, OrderNo ;

Unless you're looking for the word *score*, the % is the wildcard.

-k kai@informeddatadecisions.com
 
Thanks for the response, I was wondering if anyone was on this place... :)

I am using an MDB, MS access, Jet 4.0 table (prodata.mdb) with one table (prosingdata) in it. The MDB does not like the %, but uses the * as a wildcard.

However, when I tried your sugestion with a replce for the CRviewer part, I got a good return. Sadly with the same result, the ENTIRE DB is coming back, not just the selected info from my SQL statement (limited from report.sqlquerystring).

Anything else I can try? I am about to jump from the edge here. I guess I will have one more shot when I re-write it in native VB6. U C, I wrote it originally in VB5, and picked it back up after I upgraded to VB6. I wonder if that is a problem? It does work, save the Crystal part, however, that is one of the most important parts of this project.

Let me know if you can think of anything else or if I can provide you with more information to help you assist me. Thanks for your response, at least I know there are actually people here now. (perhaps my question is too challanging for them?) dunno.


Later, and thanks again,
Scott
 
Sorry, I missed the MDB part.

Does the report return all columns and all records, or just the correct columns, but all records?

If it's the latter, then it sounds like the where isn't getting passed. If you're using ODBC, turn the tracing on in your ODBC setup and check what's being passed.

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top