How To Pass Parameter Using Crystal Report Viewer
hi! I have a report to which i am passing a parameter value custid i was earlier using just the rdc control and showing the report and passing the parameter by
CrystalReport1.ParameterFields(0) = "custid;" & Combo2.Text & ";true"
now when i use crystal viewer using the foll. code
Dim app1 As CRAXDRT.Application Dim rep As CRAXDRT.Report
Private Sub Form_Load()
Set app1 = New CRAXDRT.Application Set rep = app1.OpenReport("c:sales1.rpt", 1)
With Form1 .Show .CRViewer1.ReportSource = rep .CRViewer1.ViewReport End With End Sub
the report prompts for a parameter
How can i pass the parameter to the report within this code so that the viewer does not prompt for any input thanks in advance Mukul
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Pass A Parameter Value To Crystal Reports Viewer
Hello All,
I’m having difficulty trying to pass a parameter from a text field on a form in my Access application to a Crystal report - which will be displayed in the Crystal Viewer.
CODE
Dim CrxApplication As CRAXDRT.Application
Dim CrxReport As CRAXDRT.Report
Dim strOutputPath As String
strOutputPath = CurrentProject.Path & "CR_Reports"
' Open the Report specified in the Open Common dialog control
Set CrxApplication = New CRAXDRT.Application
Set CrxReport = CrxApplication.OpenReport(strOutputPath & "CRpt", 0)
Parameter Fields Are Not Displayed In The Crystal Report Viewer
Hi, I have an application written in VB. I pass Parameter Fields to Crystal report object through VB and view the report in crystal report viewer. I am able to see all the records in the viewer. However, I have inserted one of the parameter Field object in the report. I am not able to see the value of that Parameter field in the report. It is blank. Currently I am using Crystal reports 9. If I try to view the records from the crystal reports itself than I am able to see all the records including the Parameter Field which I am unable to see when I pass through VB application. Kindly help ..
How To Pass Query String To Crystal Report Viewer ?
I have a VB application with 2 forms: Form 1 has a combo box Dept List and ViewReport button, and form 2 has Crystal Report Viewer only. When user choose item from Dept list, I will select in SQL database based on what user enters and pass that query to crystal report viewer but I got error at last line of from 2, say "Subscript out of range". Here is my code. Please help me to figure out this error or you have better way to display report. Thanks for any help.
Form1:
Private Sub ViewReport_Click()
Dim cn As New ADODB.Connection
Dim StrSQL As String
Dim sDeptNameList As String
Dim f As New Form2
cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;pwd=sa;Initial Catalog=Employees;Data Source=Test"
cn.Open
sDeptNameList = Trim(cboDeptList.Text)
StrSQL = "SELECT * FROM Dept WHERE Dept = '" & sDeptNameList & "'"
'''View report
f.sql = StrSQL
f.sFormDeptPhoneList = """" & sDeptNameList & """"
'''End View report
cn.Close
Set cn = Nothing
End Sub
Form2:
Public sql As String
Public sFormDeptPhoneList As String
Private Sub Form_Load()
Dim crysapp As New CRAXDRT.Application
Dim rep As New CRAXDRT.Report
sFile = App.Path & "DeptPhoneList.rpt"
Set rep = crysapp.OpenReport(sFile)
crysapp.LogOnServer "p2ssql.dll", "Test", "Employees", "sa", "sa"
rep.SQLQueryString = sql
rep.FormulaFields(0).Text = sFormDeptPhoneList
End Sub
To Pass Parameter From Vb6 To Crystal Report
Hello Friends,
My problem is I want to accept value from user which I am nt storing in databasse. I am using inputbox to get value from user and then I want to print the same value in the crystal report. I am not using crystal report viewer, but I've used crstyal report's ocx and from there i am opening report by using printreport method of the crystal report's ocx control. plz help me.
below is my code which i m using to print report
VB Code:
With crStudList .Connect = strConn .ReportFileName = App.Path & "
eportsStudentList.rpt" .ReportTitle = "Student List" .WindowTitle = "Student List" '.SelectionFormula = "{tblStudent.RegistrationDate}>= DateValue (" & dtpFrom.Value & ") and {tblStudent.RegistrationDate}<= DateValue(" & dtpTo.Value & ")" .SelectionFormula = "{tblStudent.RegistrationDate}>=#" & Format(dStartDate, "dd/MM/yyyy") & "# and {tblStudent.RegistrationDate}<=#" & dEndDate & "#" .Destination = crptToPrinter .PrintReport End With
where crStudList the name of ocx control of crystal report
thanks
How VB Pass Parameter To Crystal Report
how to pass Parameter to Seagate Crystal report by VB?
I want to pass One or More parameter to Crystal report to meet a certain critera
like i want to select some record by my application given date so report should be contains only those record sort by given date.
How To Pass A Parameter In Vb Using Crystal Report 9.0
hi,
i'm using vb 6.0 , access 98 & cr 9.0. plz help me how to pass a parameter using vb 6.0 .
in run time.
regards
chitkrish
vikramjb : post moved to the reporting section. Please post in the approriate forums.
Edited by - vikramjb on 12/22/2005 2:08:48 AM
How Do I Pass A Parameter Range To A Crystal Report (v8.5)?
Hi
I am using VB6 and Crystal 8.5 (the database is only compatible with this version of Crystal.
I need to pass a parameter range to my VB code, the parameter works fine in Crystal, but I cannot work out how to pass the parameter range in code.
All help very welcome!
Thanks
Blinking Nora
Pass BLOB Parameter To Crystal Report
I would like to display the image from the local file system where I can pass the path or the whole image (in BLOB fieldType). But I found that I cannot set the parameter field type into BLOB (only can set String, Date, Time, etc). What can I do? I found that it works when the photo is stored in database only. Is there anybody can solve this problem?
How Can I Pass Parameter From VB6 To Crystal Report7
I am new In VB & Crystal ,How Can I Pass Parameter from VB6 to Crystal Report7
I was try to pass parameter use Crystal Reports ActiveX Designer Run Time Library but i can not pass it please provide code for passing parameter
To Pass Parameter To Crystal Reports From Vb
hi
i had to pass a parameter for report generation. the parameter has to be passed from a vb -form. i have to do it without reentering(ie directly pass the parameter)
plz help
thanx in advance
Pass Parameter To Date Report
I have one more question to ask,
I want to pass some parameter from a form to a data report so that what the user entered in the form can be display on the data report, how can I do it.
I can't find any way to do so.
Thanks....
Pass A Date Parameter For A Report
I have a timesheet management programme which I have written in VB6 which uses an Access97 database. I have several tables, one of which has project details (Projects) and one all the pay and expenses (Timesheets). The ProjectID links both tables.
I have a DataEnvironment ( deProject), a DEConnection (Timesheet222), a DECommand (cmdProject) and a child DECommand (cmdTimesheet).
cmdTimesheet has an SQL statement in the property CommandText
SELECT* FROM Timesheets WHERE Timesheets.dateofwork BETWEEN #31-Mar-07#
AND #05-Apr-07#
ORDER BY Clientname,EmployeeID,DateOfWork DESC
This works fine but I cannot change the dates at run time. I need to be able to pass the date parameters to a statement like this.
I can do this if I only use cmdTimesheet but I want to structure my reports to have the ProjectID and Project Name in a main heading.
Any suggestions would be welcome.
Pass Parameter To Crsytal Report
I have an app that opens a crystal report, sets the login info, passes the parameter, then exports the report. Below is part of the code I am using. I need to run this report multiple times with new parameter values. How can this be accomplished without doing OpenReport everytime?
Dim Report As New CRAXDRT.Report
Dim crxApp As New CRAXDRT.Application
Sub RunReport()
Set Report = crxApp.OpenReport("test.rpt",1)
'''Here I set the login
Report.ParameterFields(1).AddCurrentValue (ldr_id)
With Report.ExportOptions
.DiskFileName = slocation
.FormatType = crEFTPortableDocFormat
.PDFExportAllPages = True
.DestinationType = crEDTDiskFile
End With
Report.Export (False)
Set Report = Nothing
Set crxApplication = Nothing
End sub
Pass Parameter To Child Command In Data Report
hi, ....
i'm using DE connected to Access, and my DE is like this...
Company (Parent Command)
a
b
c
SQL(child command) <<== Problem ***
k
l
m
acccoutingng (child command)
x
y....
i used the SQL builder to setup the sql statement like this ...
"SELECT Brno, City, CNno, Tseqno, TDate, Payment, DOno FROM FECMS_Transaction WHERE (TDate = ?)"
, and went to setup parameter. Everything seems fine except the relation part. I need it to have a relation with the previous level (Company). when i assign the relation, an error message comes out said
"All required parameters must be linked with a parent field." I'm pretty sure linking the right fields between these 2 tables. If i didn't do this part, this level will becomes the same level like "Company".
can someone help me, million million thanks.....
How To Pass Format String To Crystal Report From VB And How To Use It In Crystal Report?
Hi,
I am working on VB 6.0 and using crystal report 7 as reporting tool.
In report, some clients are asking 3 decimal places(Eg. 2000.500) while other clients are asking 2 decimal places(Eg. 2000.50) for numeric fields.
I want to pass the amount of decimal places for numeric fields to crystal report from VB.
How should I implement this using VB.
Pls any one can help me?
Thanks in vance,
Soundar
Passing Crystal Report Or Viewer A Value Used For Filtering The Report
I having a problem trying to filter out my crystal report based on a case number which is a primary key in my access table tblCaseInfo. I am trying to do this through vb.net so when the user is viewing a particular case they can click the print button and print only that particular case being viewed. The case number will be coming from a textbox (txtCaseNumber.text) on the form in vb.net.
As of right now when the print button is clicked every case in the database is displyed in the crystal report viewer to be printed.
I have three tables involved:
tblCaseInfo - VictimID, AssailantID are foreign keys for the table listed below
tblVictimInfo - VictimID Primary Key
tblAssailantInfo-AssailantID Primary Key
Only code I have so far:
Private Sub btnPrintSurveyReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrintSaveSurveyReport.Click
frmSurveySummaryReportInstance.ShowDialog()
End Sub
Pass Input Parameter From Query To Report In Access 2000
I am using a parameter query to sum information from a table. Part of the parameters is to specify the date range to be summed as shown below:
SELECT TOP 10 [Lost Time Codes].Reason, Sum([Master Lost Time Entries].Minutes) AS SumOfMinutes
FROM [Lost Time Codes] RIGHT JOIN [Master Lost Time Entries] ON [Lost Time Codes].code = [Master Lost Time Entries].[Downtime Code]
WHERE ((([Master Lost Time Entries].Shift)="1st") AND (([Master Lost Time Entries].Date) Between [Enter Start Date] And [Enter End Date]) AND (([Lost Time Codes].Area)="THT"))
GROUP BY [Lost Time Codes].Reason
ORDER BY Sum([Master Lost Time Entries].Minutes) DESC;
I want to pass the the [Enter Start Date] and [Enter End Date] inputs to the report containing a chart. Anyone know how to do this, or of a completely different way to accomplish the same task without using the above query?
Edit by Moderator:
Please post SQL questions, in the Database forum.
Thank you.
Sometimes Repeating Previous Dates Data In Report When I Pass Parameter From Vb !
Hai the below is my code,
I am using more than 10 option button in my form. when the form load the textbox will automatically show the date by the code below, when the user check 4 or five reports using different option buttons and while changing the date in the text box, the report is showing for previous date, i also remove the check box for the [Save Data with Report] in the File Menu, when the user changes the date for the first time, it shows the report correctly, kinly see the code below and reply me. I don't know where's the mistake from.
when i exit the application and give for a new date it works, where as repeatedly when i do the same for 6 or some times and change the date, the report for the previous date is shown. I also use break point and checked, it passing the date correctly.
the below are the codes which i am using to display the report.
I also attached the front view of the form, by seeing that u can be clear what's happening.
Private Sub Form_Load()
txtFrom.Text = Format(Date - Day(Date) + 1, "YYYY/MM/DD")
txtTto.Text = Format(Date, "YYYY/MM/DD")
End Sub
Private Sub cmdPreview_Click()
fdt = txtFrom
tdt = txtTo
If Option1.Value = True Then
Call Productwisereport
ElseIf optItem.Value = True Then
Call Itemwisereport
Else
MsgBox "Choose Option !", vbExclamation, "Option - Missing"
End If
End Sub
Private Sub Prodcutwisereport ( )
fdt = txtFrom
tdt = txtTo
If Len(cmbProduct.Text) <= 0 Or cmbProduct.Text = "All" Then
CrystalReport1.ReportFileName = App.Path & "sumcstwisewgt.rpt"
CrystalReport1.Formulas(0) = "fdt='" & fdt & "'"
CrystalReport1.Formulas(3) = "tdt='" & tdt & "'"
strsf = "{Sales.SoldDate} in Date(" & _
Format(fdt, "YYYY,M,D") & ") to Date(" & _
Format(tdt, "YYYY,M,D") & ")"
CrystalReport1.ReplaceSelectionFormula (strsf)
CrystalReport1.Action = 1
Else
CrystalReport1.ReportFileName = App.Path & "sumcstwise.rpt"
CrystalReport1.Formulas(0) = "fdt='" & fdt & "'"
CrystalReport1.Formulas(3) = "tdt='" & tdt & "'"
strsf = "{ Sales.SoldDate } in Date(" & _
Format(fdt, "YYYY,M,D") & ") to Date(" & _
Format(tdt, "YYYY,M,D") & ")"
CrystalReport1.ReplaceSelectionFormula (strsf)
CrystalReport1.GroupSelectionFormula = "{ Sales.Product}='" & cmbProduct.Text & "'"
CrystalReport1.Action = 1
End If
CrystalReport1.GroupSelectionFormula = " "
End Sub
thank you very much,
Chock.
itchocks@rediffmail.com
<HTML>
<B><font color="#008000">HAVE A NICE DAY !</font></B>
<HTML>
Where Is Crystal Report Viewer?
Hi folks, i'm looking foward to print a crystal report but i'm having trouble finding the correct procedure. after looking at a few samples i noticed that every one is talking about crviewer but i can't find it anywhere, can someone help out on this? maybe i don't have the correct version of VB?
maybe someone can also give me a code sample on how to simply print the reports without having to view it.
Thanks again for the help!
Crystal Report Viewer From VB
I am about to write a program which will use Crystal Report viewer to grab reports and display them so that the users on site don't have to have crystal installed.
I would like to do this dynamically when they click on a *.rpt file.
I have worked out how to get my program to run when this happens but am not sure how to grab the 'filename' parameter which is generated (%1).
It' s probably really simple stuff but have not done this before - can anyone help?
Crystal Report Viewer
Hi friends,
How to use CRViewer to show report which is created using automation server. Please help with some sample code.
thanks in advance.
Thomas George
Crystal Report Viewer, Where Is It
I have crystal reports version 10. I install it and it adds alot of references and components, none of which I am sure does what. I have added the crystalactivexreport viewer since I cannot find any other viewer. I have then added this code
VB Code:
Dim Report As New CrystalReport1 Private Sub Form_Load()Screen.MousePointer = vbHourglassCRViewer1.ReportSource = "C: estCR 8.5
eport.rpt"CRViewer1.ViewReportScreen.MousePointer = vbDefault End Sub Private Sub Form_Resize()CRViewer1.Top = 0CRViewer1.Left = 0CRViewer1.Height = ScaleHeightCRViewer1.Width = ScaleWidth End Sub Private Sub Form_Unload(Cancel As Integer)Unload MeForm1.ShowEnd Sub
Apparently that is not anyway to do it cause no matter what I try it will not display the report. Any help would be appreciated.
Crystal Report Viewer
Hi all
I'm doing a project in VB6. I wanted tomake reports in Crystal Reprts 9. I have used prior versions of crystal reports before.
But using this version, I don't get any crystal report control in VB control component list. Ther I get only Crystal Report Viewer.
I created reports using crystal reports. but how can I display it thro' VB using Crystal Report Viewer?
Please help
Crystal Report Viewer
Hi
I have created one report (Invoice.rpt), now i want to display it in the Crystal Report Viewer Control. I am using Crystal Report 8.0. I am new to Crystal Report.
Please Help
Crystal Report Viewer And VB.NET
Could anyone tell me how to pass parameters in VB.NET 2003 to Crystal Report Viewer Control. Some lines of coding would be very much appreciated.
Crystal Report Viewer
i designed my report in crytal report, and i used a crytal report viewer on the form in VB6. i need the code to link the crystal report to the viewer and the code to view it
Crystal Report Viewer
Can any one point me to an example on how to use crystal reports in VB.I want to use CRViewer to display the report.
thanks
Crystal Report Viewer With VBA
Hello,
I'm starting to use the Crystal Report now and I'd like some tips to do a print report from data that already is available in a recordset.
I don't need to show the report I just need to print this with a predefined format.
Somebody could help me sending an example or where can I find some documentation about it?
Thanks a lot in advance.
Cleber Polli
Crystal Report Viewer Refresh
I know this has been answered many times on this form, but I can't seem to find an example like mine...and maybe that's because I'm going about it all wrong...you guys tell me.
The crystal report that I'm displaying is a stand alone crystal report based on one summary table (hitting oracle through odbc dsn). I want to replace the table that the report is based on with a sql statement (onclick of my report button) and then have the report viewer refresh the report link so that the most current version of the data is displayed in the viewer.
I can get the report to refresh at run time when clicking on the little yellow lightning bolt on the viewer...however, I would like for the viewer to refresh the report on the initial load of the report.
I've tried crviewer1.refresh and I get an error message that says "method'refresh' of object 'Icrystalreportviewer3' failed? However when I hit debug and then just hit run again from design mode, it does refresh the report.
thanks here's my code
Dim NETADCREATEQRY As String
Dim NETADDROPQRY As String
Dim crysApp As New CRAXDRT.Application
Dim selectedreport As String
Dim myRpt As CRAXDRT.Report
NETADDROPQRY = "DROP TABLE NETWORK_ADEQUACY_RPT;"
NETADCREATEQRY = "CREATE TABLE NETWORK_ADEQUACY_RPT AS SELECT DESCRIPTION, SUM((CASE SUBSTR(C.CCHP_RESTRICTIONS,1,1) WHEN '1' THEN 1 ELSE 0 END)) OPEN_PCPS, SUM((CASE SUBSTR(C.CCHP_RESTRICTIONS,1,1) WHEN '2' THEN 1 WHEN '3' THEN 1 ELSE 0 END)) CLOSED_PCPS, (CASE C.IPA_GROUP_NAME WHEN 'CCPN' THEN 'YES' Else 'NO' END) CCPN, COUNT(D.PROV_NO) TOTAL, SUM((CASE SUBSTR(C.CCHP_RESTRICTIONS,1,1) WHEN '1' THEN 1 ELSE 0 END))/COUNT(D.PROV_NO) PERCENT_OPEN FROM PHYDEMOGRAPHIC D, PHYSPECIALTY A, PHYADDRESS B, PHYLOB C, COUNTIES E WHERE D.PROV_NO = A.PROVNO (+) AND D.PROV_NO = B.PROVNO (+) AND D.PROV_NO = C.PROVNO (+) AND B.CTY_CODE = E.CODE (+) AND A.PRVTYP = 'PCP' GROUP BY (CASE C.IPA_GROUP_NAME WHEN 'CCPN' THEN 'YES' Else 'NO' END), E.Description ORDER BY (CASE C.IPA_GROUP_NAME WHEN 'CCPN' THEN 'YES' Else 'NO' END) DESC;"
' DROP AND RECREATE THE NETWORK ADEQUACY REPORT TABLE
With cmd
Set .ActiveConnection = con
.CommandType = adCmdText
.CommandText = NETADDROPQRY
End With
With rs
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.CursorLocation = adUseClient
.Open cmd
End With
With cmd
Set .ActiveConnection = con
.CommandType = adCmdText
.CommandText = NETADCREATEQRY
End With
With rs
.LockType = adLockOptimistic
.CursorType = adOpenDynamic
.CursorLocation = adUseClient
.Open cmd
End With
selectedreport = "J:ReportsGen30Completed_ReportsREPORTING DIRECTORYNETADEQ.rpt"
Set myRpt = crysApp.OpenReport(selectedreport)
Call myRpt.Database.Tables(1).SetLogOnInfo (mngp, , "mylogon", "mypwd")
With RPTS
.Show
Screen.MousePointer = vbHourglass
.CRViewer1.ReportSource = myRpt
.CRViewer1.ViewReport
.CRViewer1.Zoom 100
.CRViewer1.Refresh
Screen.MousePointer = vbDefault
End With
Closing Crystal Report Viewer
My crviewer is on a form I want to close the view but not the form.
I craeted a button to close the viewer with the code crviewer.closeview,
but I get an error message "Argument not optional" what am I doing wrong.
Crystal Report Viewer Beginner
I am a beginner in the field of Crystal Report Viewer and desprately need help.
I just want to load a report, insert the parameters and view the report, however it is playing silly beggers with me!
Can anyone tell my what i am doing wrong?
BELOW IS MY CODE:
Code:
If Not Session("InputParms") Is Nothing Then
Dim Parms() As String = CType(Session("InputParms"), String())
Dim strParmNames() As String = CType(Session("ParmNames"), String())
Dim i As Integer
Report.Load("C:Test EnvironmentsDGS Reports" & ddlDepartment.SelectedValue & "" & ddlReport.SelectedValue, OpenReportMethod.OpenReportByTempCopy)
For i = 0 To UBound(Parms) Step 1
Report.SetParameterValue(strParmNames(i).ToString, CObj(Parms(i).ToString))
Next
End If
Dim logoninfo As New TableLogOnInfo
Dim table As CrystalDecisions.CrystalReports.Engine.Table
For Each table In Report.Database.Tables
logoninfo = table.LogOnInfo
With logoninfo.ConnectionInfo
.ServerName = "DEV-ERPDBS"
.DatabaseName = "Test"
.UserID = "test"
.Password = "test"
End With
table.ApplyLogOnInfo(logoninfo)
Next
With crv
.ReportSource = Report
.Visible = True
End With
Thanks
Crystal ActiveX Report Viewer
VB 6 Enterprise; Crystal Reports XI Developer Edition
Is there any way to get rid of (not display) that hideous "Business Objects" icon in the upper right hand corner of the Viewer?
Thanks, Sam
Crystal 9 Report Viewer Progress Bar
Hi
I am confused about the crystal reports veiwer. When it is loading, which can take some time, I would like the user to be informed of the progress but this does not seme to happen. I have set the CRV.EnableProgressControl = True and it shows a progress bar at the top of the viewer but it sits there motionless.
I have had a search on the forum for any information on this but all I could find was something saying it was not possible to show a progress bar. Could this realy be the case?
If you can't show a progress bar is it possible to show something moving to keap the user entertained like:
Code:
CRV.ViewReport
CRV.EnableProgressControl = True
CRV.ReportSource = crxReport
CRV.ViewReport
CRV.Refresh
CRV.Visible = True
fraProgress.Visible = True
Me.Show , frmParent
frmParent.SetFocus
Incrament = 1&
Do While .CRV.IsBusy = True
DoEvents
Debug.Print "Loading "
PB.Value = PB.Value + Incrament
If PB.Value = PB.Max or PB.Value = PB.Min Then
'Show a Kit effect
Incrament = Incrament * -1&
End IF
PB.Refresh
Loop
fraProgress.Visible = False
But when I try this I get one debug print despite the load taking up to a minute!
Any help would be appeciated.
Crystal Report Viewer - Not Supported
I had create crystal report and run in application vb6. But one of the report pop-up crystal report viewer "Not Supported" message, so the blank report is return. I try it in crystal report is no problem, but dont know how the problem come out. I hope you all can help me to find the solution.
Thanks you
Vb Crash When Using Crystal Report Viewer
hi, i'm using crystal report 9 professional version. i can compile my code. but when i click a command button in my form to generate the report. it will crash the vb. what is the meaning of this? i'm 100% confirm that the vb and crystal report were installed properly. i think the problem is caused by the connection property settings. if i don't use it, it work. but if i set the connection property, it will crash. could it because of i'm using professional version? because it don't allow me to use certain function of developer version IMO. please help!!! here's my code
Code:
Private Sub showreport(rpt As String)
Dim crxApp As CRAXDRT.Application
Dim crxReport As CRAXDRT.Report
Dim crxTable As CRAXDRT.DatabaseTable
Dim CPProperty As CRAXDRT.ConnectionProperty
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sSelect As String
Dim sRep As String
Set crxApp = New CRAXDRT.Application
Set crxReport = crxApp.OpenReport(App.Path & "/" & rpt & ".rpt", 1)
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
sSelect = "SELECT * FROM tbitem where categoryid = 5 "
sRep = App.Path & "/dbar.mdb"
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & sRep & ";Persist Security Info =False"
cn.Open
rs.Open sSelect, cn, adOpenKeyset, adLockOptimistic, adCmdText
For Each crxTable In crxReport.Database.Tables
Set CPProperty = crxTable.ConnectionProperties("Provider")
CPProperty.Value = "Microsoft.Jet.4.0"
Set CPProperty = crxTable.ConnectionProperties("Data Source")
CPProperty.Value = App.Path & "/dbar.mdb"
Set CPProperty = crxTable.ConnectionProperties("User ID")
CPProperty.Value = ""
Set CPProperty = crxTable.ConnectionProperties("Password")
CPProperty.Value = ""
crxTable.Location = App.Path & "/dbar.mdb"
Next
' For Each crxTable In crxReport.Database.Tables
' 'for OLE DB the properties would like this.....
' With crxTable.ConnectionProperties
' .item("Provider") = "Microsoft.Jet.4.0"
' .item("Data source") = App.Path & "/dbar.mdb"
' '.item("Initial Catalog") = "Catalog"
' .item("User ID") = ""
' .item("Password") = ""
' End With
' crxTable.Location = App.Path & "/dbar.mdb"
'Next
crxReport.DiscardSavedData
crxReport.Database.SetDataSource rs
CRViewer91.ReportSource = crxReport
CRViewer91.ViewReport
Screen.MousePointer = vbDefault
End Sub
Crystal Report Viewer Control 9
Hi to all,
I'm newbie in crystal report 9 link with vb6. Now, I m facing big problem in Crystal Report 9. I don't know how to use Crystal Report 9 viewer control to view my report n print it out. Can somebody help me?
Will someone give me a solution and sample? Thanks.
|