Results 1 to 7 of 7

Thread: Two Crystal Report 8.5 in vb6

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    4

    Two Crystal Report 8.5 in vb6

    Hello,

    how can i use 2 crystal reports in VB6?

    I have used 1 Crystal Report for my Sample Inventory but I can't use another in another Report.


    Please Help me As Soon as Possible.

    Thanks,
    Pau

  2. #2
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,195

    Re: Two Crystal Report 8.5 in vb6

    Why can't you use more than one? Do you get an error? If so, explain what error. Show your code, show the error. You should be able to have as many reports as you need.

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    4

    Re: Two Crystal Report 8.5 in vb6

    Here's My Code.

    Code:
    Private Sub cmdLoad_Click()
    
    cmdLoad.Enabled = False
    Dim DApp As CRAXDDRT.Application
    Dim DReport As CRAXDDRT.Report
    RS.Open "Select * from TempDR", CN, adOpenKeyset, adLockOptimistic
    Set DApp = New CRAXDDRT.Application
    Set DReport = DApp.OpenReport(App.Path & "\DeliveryReceipt.rpt", 1)
    DReport.Database.SetDataSource RS, 3, 1
    CRView.ReportSource = DReport
    CRView.ViewReport
    cmdRefresh.Enabled = True
    End Sub
    It says "Run-time error '424': Object Required"

    I don't know what's wrong, I just have the same Coding from my other Report.

    Code:
    Private Sub cmdLoad_Click()
    cmdLoad.Enabled = False
    Dim OApp As CRAXDDRT.Application
    Dim OReport As CRAXDDRT.Report
    RS.Open "Select * from Inventory", CN, adOpenKeyset, adLockOptimistic
    Set OApp = New CRAXDDRT.Application
    Set OReport = OApp.OpenReport(App.Path & "\InventoryReport.rpt", 1)
    OReport.Database.SetDataSource RS, 3, 1
    CRView.ReportSource = OReport
    CRView.ViewReport
    cmdRefresh.Enabled = True
    End Sub

    I also use this as Module.

    Code:
    Public CN As ADODB.Connection
    Public RS As ADODB.Recordset
    Sub MainDR()
    Set CN = New ADODB.Connection
    Set RS = New ADODB.Recordset
    CN.ConnectionString = "Provider=microsoft.jet.oledb.4.0; data source=" & (App.Path & "\Invent.mdb") & ";"
    CN.Open
    frmMain.Show
    End Sub
    Can i use this module again for the other Report?.

  4. #4
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,195

    Re: Two Crystal Report 8.5 in vb6

    Which line of code is causing the error? You should put "RS.close" after you run the report. Why don't you try creating a local recordset instead of using a Public recordset.

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    4

    Re: Two Crystal Report 8.5 in vb6

    Error is on CRView.ReportSource = DReport

  6. #6
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,195

    Re: Two Crystal Report 8.5 in vb6

    It looks like your using two different forms. One the run "OReport" and one to run "DReport". Is that what your doing? If thats the case, are you sure you have a "CRView" on both forms? Was the DeliveryReceipt report designed using the TempDR table? Without more information about how the reports were created and how your app works, I don't have any other ideas.

    But you show definitely be closing things like "Oapp" when your done with it.

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    4

    Re: Two Crystal Report 8.5 in vb6

    I have run my Report already, by the way thanks for the response on my post.
    i really appreciate it

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