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
Printable View
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
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.
Here's My Code.
It says "Run-time error '424': Object Required"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
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.
Can i use this module again for the other Report?.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
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.
Error is on CRView.ReportSource = DReport
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.
I have run my Report already, by the way thanks for the response on my post.
i really appreciate it :)