Results 1 to 3 of 3

Thread: passing sql statements to data reports in vb6

  1. #1
    Guest

    Post

    i am trying to put some run time parameters into a data report. so the sql statement is being created out side the report, but the connection to the db is done within the report, how do i (a) pass the sql statement to the connection or (b) pass it straight to the report?

  2. #2
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374

    Post

    What are you using as the data source? Are you using the Data Environment? If so, this is what I suggest: First read the section "Writing a report" in part 6 of the Visual Basic Database Tutorial on this website (don't remember the exact address so you will have to do a search).

    This is how I change the SQL at run time when using the Data Environment and Data Reports. I make a hypothetical SQL statement at design time in the Data Environment where I have the structure designed the way I want it later (I don't worry about filters, WHERE statements, or anything at this time; I only need to define the relations between the tables. The tutorial will show you how to do this).

    The defined structure has a property called the Hierarchy Info that you can view by right-clicking on the top command. I copy this SQL from the window and then paste it into a subroutine, like this:

    Code:
    Private Sub Command1_Click()
    
    MyDataEnvironment.Commands("Command1").CommandText = 'enter the SQL here and make the modifications to the parameters
    
    End Sub

  3. #3
    Guest

    Post

    thanks a lot , that worked perfectly

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