Results 1 to 3 of 3

Thread: Stupid Crystal Report Question

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2003
    Posts
    44

    Angry Stupid Crystal Report Question

    I am building a little report to be displayed on a windows form. I am creating a data set on the fly and pushing that to the report.

    My question is how do I add the appropriate fields to the report in design mode if I can't see the the fields since I am building the dataset on the fly.

    I have attached the table I am working with to the report to get fields but as soon as I delete the table the fields go with it.

    Do I use unbound fields then bind them on the fly, I just don't know.

    I hope this makes sense, I am assuming there is a simple trick to this!!!

    Frank

  2. #2

    Thread Starter
    Member
    Join Date
    Jan 2003
    Posts
    44

    I figured out one solution, probably not the best solution

    I attached the tables in the report with an oledb connection. Then I found an example of pushing the user login information to the report . Once I pass the user logon information to the report, the report comes up right away with out asking for a second logon screen.

    Private Sub LogonToReport(ByVal server As String, ByVal database As String, ByVal userID As String, ByVal password As String)

    Dim logOnInfo As New TableLogOnInfo()
    Dim table As Table

    ' Set the connection information for the table in the report.
    For Each table In PatientReport.Database.Tables
    logOnInfo.ConnectionInfo.ServerName = server
    logOnInfo.ConnectionInfo.DatabaseName = database
    logOnInfo.ConnectionInfo.UserID = userID
    logOnInfo.ConnectionInfo.Password = password
    'logOnInfo.TableName = table
    table.ApplyLogOnInfo(logOnInfo)
    Next table

  3. #3
    New Member
    Join Date
    May 2002
    Posts
    6
    Yes, its possible to bind the objects during runtime. But that is too much work. You can quickly create a dataset object and base the report off that. Then delete it when you are done. Connect during runtime and your fields will print fine. The way you did it, creating a temporary OLEDB connection also works.

    See Chapter 14 of this free ebook to learn more about databinding and Crystal Reports.


    http://www.CrystalReportsBook.com?cpgn=vbforum

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