Results 1 to 3 of 3

Thread: Crystal reports

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    RI
    Posts
    9

    Unhappy

    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

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    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 & "'"


    "It's cold gin time again ..."

    Check out my website here.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2000
    Location
    RI
    Posts
    9
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width