-
Im using VB 6.0 and Crystal Reports 7.0, and running the query command
Crystalreports1.SQLQUERY = "SELECT * FROM Table1 WHERE item=item1"
when I print the report I still get the entire database (that is all the items item1 - item100)
Does anyone know why? Is this a VB syntax error or a Crystal Reports design error?
Please help.
Thanks
TB
-
It seems like a problem with the way you formulated your SQL statement. If you want to select all the records where a field in the record matches a value stored in a variable, your code should have this form:
Crystalreports1.SQLQUERY = "SELECT * FROM Table1 WHERE FieldInTable = '" & strSomeVariable & "'"
-
In my code my select statement is in the format you sent. I've used the same statement successfully in my program to read and write from the database. My problem lies in letting Crystal reports know what to display at run time. Unfortunately the query variable changes everytime the user is running a report, so I cant use the SQLquery directly in Crystal reports and have to bind the report from VB.
Thanks for trying
TB