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

Can Crystal handle a SQL statement with the 'Like' clause?

Status
Not open for further replies.

SirPaladin

Programmer
Jul 9, 1999
32
0
0
US
This may just be the last straw before I give up on using Crystal Reports and design my own report designer. It seems that when I define a record set for the report that includes the SQL 'Like' statement, it doesn't report the records and comes up blank. Is Crystal Reports incapable of working with the statement? Is there a work-around? Here's my SQL statement (Saved in variable ReportSQL$):<br>
<br>
SELECT * FROM [Companies] WHERE [Companies].[RecordDate] &gt;= #1/1/98# AND [Companies].[RecordDate] &lt;= #10/8/99# AND [Companies].[Industry] Like '*Recruiter*' ORDER BY [Company]<br>
<br>
And here's how I'm calling the report:<br>
<br>
Dim rs As New ADODB.Recordset<br>
<br>
If Len(ReportSQL$) = 0 Then<br>
MsgBox &quot;Recordset not selected yet. Use the Query form first&quot;<br>
Unload Me<br>
End If<br>
<br>
'Use this SQL statement to select the records to use<br>
rs.Open ReportSQL$, _<br>
&quot;DSN=&quot; & DSN$ & &quot;;&quot;, adOpenKeyset<br>
Report.Database.SetDataSource rs<br>
<br>
CRViewer1.DisplayGroupTree = False<br>
CRViewer1.ReportSource = Report<br>
CRViewer1.ViewReport<br>
<br>
When I send it SQL statements without the 'Like' clause, it works fine, but that's not good enough. Anyone have a clue? Anyone know of a better report designer?
 
I haven't had any problems with the LIKE in Crystal Reports, but I have used the standard SQL syntax of <br>
Like '%Recruiter%' instead.<br>
If you have problems with your SQL, I have found the best way to trouble shoot it is to copy it to a simple query tool, like Query Designer, MS Query, etc, and ensure that it runs from there. If the SQL won't run, then your problem is not with Crystal, but with your SQL. <p>Malcolm Wynden<br><a href=mailto:wynden@island.dot.net>wynden@island.dot.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top