-
Feb 13th, 2012, 08:30 PM
#1
Thread Starter
New Member
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
-
Feb 13th, 2012, 10:12 PM
#2
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.
-
Feb 14th, 2012, 12:32 AM
#3
Thread Starter
New Member
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?.
-
Feb 14th, 2012, 03:00 PM
#4
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.
-
Feb 15th, 2012, 01:16 AM
#5
Thread Starter
New Member
Re: Two Crystal Report 8.5 in vb6
Error is on CRView.ReportSource = DReport
-
Feb 15th, 2012, 02:55 AM
#6
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.
-
Feb 15th, 2012, 08:51 PM
#7
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|