Results 1 to 2 of 2

Thread: Passing an SQL statement into Crystal Reports

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    treehouse
    Posts
    106
    I am tyring to query data out of my Db and pass it into crystal reports and display it based on what the user searches for. How do you pass a SQL statement into crystal reports through VB. I am using the crystal report component but I cant find a method or property that will update my crystal report. Here is my code.

    sSQL = "SELECT * FROM Tracking"
    sGroup = "GROUP BY Date HAVING User=" & txtAdd(16).Text

    if len(sGroup) > 0 Then sGroup
    CrystalReport1. ? (this is where I am stuck)
    CrystalReport1.PrintReport

    Note: This is my first time using crystal reports and I am not very familiar with its methods and properties. I have been playing around with it but I can't get it to work. I created the report and it displays data based on the user name I inserted but I wanted to update it based on what the user queries out in VB.

  2. #2
    Lively Member Ishamel's Avatar
    Join Date
    Nov 1999
    Location
    Edinburgh, Scotland
    Posts
    112
    Try using the SelectionFormula property.

    Code:
    CrystalReport1.SelectionFormula = sSQL
    Hope this helps.

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