Solved

Crystal Reports Problem... Urgent

Posted on 2002-04-24
8
230 Views
Last Modified: 2010-05-02
Hi

I have some problem in connecting viewing the report designed in crystal reports 8 from visual basic 6.

I have created a report in crystal report 8 connecting to database from crystal reports itself and i am successful in completing the report

now i want to call that report from visual basic 6, but i unable to do that. i want to give my own database connection string and query, taking that connection and query it has to display the report.

can anyone help me in solving this problem.

pls let me also know which reference i have to add in the visual basic 6.0

Thanks in advance
Hari.
0
Comment
Question by:sharibabu
8 Comments
 
LVL 1

Expert Comment

by:Chess
ID: 6965588
Hari,
You need something like this:

Dim i As Integer
Dim sreport_name As String
Dim sreport_fund_num       As String
Dim sreport_processingdate As String
Dim sprocess_type   As String
Dim crapplication  As New CRAXDRT.Application
Dim crreport       As CRAXDRT.Report

sprocess_type = "REPORT"
    sreport_name = "IMPEXTRUndSec.rpt"
   
    sreport_name = App.Path & "\REPORTS\" & sreport_name
   
   
    Set crreport = crapplication.OpenReport(sreport_name)
     For i = 1 To crreport.Database.Tables.Count
        crreport.Database.Tables(1).SetLogOnInfo gServerName, gDbName, gLogin, gPassword
        crreport.Database.Tables(1).Location = gDbName & ".dbo." & "sp_get_remote_trades_und_sec"
       'MsgBox crreport.Database.Tables(1).TestConnectivity
     Next i
    crreport.ParameterFields(1).AddCurrentValue (sreport_fund_num)
    crreport.ParameterFields(2).AddCurrentValue (CDate(sreport_processingdate))
    frmReport.rptViewer.ReportSource = crreport

        frmReport.rptViewer.ViewReport
       frmReport.Show

Hope this helps.
Chess
0
 
LVL 3

Accepted Solution

by:
n_narayanan earned 50 total points
ID: 6965601
You have to add a crystall reports component from
Project / Components menu.



    rptControl.Connect = "odbc;dsn=CoreFa;uid=pent;pwd=pentadmin"
    rptControl.ReportFileName = App.Path & "\Reports\" & ReportName
        rptControl.Action = 1

Where rptcontrol is the Crystal Reports Conrol Name.

Create a DSN called CoreFa (u can change this) and store the database settings.

Cheers

Narayanan.
0
 
LVL 3

Expert Comment

by:n_narayanan
ID: 6965605
If you want to supply a where clause then,

rptControl.SelectionFormula = whereclause
0
 
LVL 2

Expert Comment

by:corvanderlinden
ID: 6965638
Private mCRXApplication  As CRAXDRT.Application
Private mCRXReport       As CRAXDRT.Report

Set mCRXApplication =
CreateObject("CrystalRuntime.Application")

Set mCRXReport = mCRXApplication.OpenReport(ReportName)

Pass the recordset to the report engine to use as the datasource
mCRXReport.Database.SetDataSource rs

This recordset must be exactly the same as the one you used in the standalone report
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Expert Comment

by:corvanderlinden
ID: 6965645
Reference:
Crystal reports 8.5 ActiveX Designer Runtime Library
Crystal report Viewer Control
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 6966143
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7670171
Hi sharibabu,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept n_narayanan's comment(s) as an answer.

sharibabu, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 8092513
Comment from expert accepted as answer

Computer101
E-E Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now