Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Visual Basic





See Related Forum Messages: Follow the Links Below to View Complete Thread

Passing Parameter To Crystal Report
Hello
I want to ask you How can I pass a parameter field to crystal report from Visual Basic 6 ????
I am using the Crystal Report Viewer .

Thank you very much!!!!

Passing A Parameter To Crystal Report
Hello Everyone! I'm new to crystal reports and I want to make an inventory that could pass a parameter to a crystal report. Could you guys help me how to do it? I just need a few simple examples on how to start. Any help will be greatly appreciated. Thanks and god bless!

Crystal Report - Passing Parameter
Hi,

please tell me the syntax of SetReportVariableValue in crystal report. I am getting Run-time error '70' permission denied when I try this. any other way to pass parameter to the report? (I'm using CR 9 with VB 6)

Thanks in advance!

Binish

Passing Parameter To A Crystal Report
i'm using vb6 and crystal reports 8.5. i have a string value that i need to pass to my rpt. here is the sample of my code:

Set CRReport = New CRAXDRT.Report
Set CrxApp = CreateObject("CrystalRunTime.Application")
Set CRReport = CrxApp.OpenReport(vstrReportFile)
CRReport.Database.SetDataSource vPassedADORS, 3, 1
CRViewer1.ReportSource = CRReport
CRReport.ParameterFields(0) = " Par1;" + vstrParameters + " ;true"
CRReport.PrintOut False, 1, True

when i run this code i get the error subscript out of range.

when i create another project that uses the crystal report component i use the following code:

cry1.ParameterFields(0) = " Par1;" + vstrParameters + " ;true"
cry1.printreport

it works fine.

can any one help?

Thank You,
Thomas

Parameter Passing In Crystal Report
I have designed a report in Crystal report 7.0 and wanted to view it thru VB6.0 application. I am using crystal report control. When I refresh my report from crystal report and enter a specific date the report generates for that date but when I refresh it from my VB application and enter any date its not giving anything. Do I need to set some property or something else. please help me. its very urgent.

Kirti

Passing Parameter To Crystal Report
i'm using the CRViewer to view my report. i found out i cannot pass in Date into crystal report from VB. any one can give me help?

sample code:
CrxReport.ParameterFields(1).AddCurrentValue (format(now,"dd/mm/yyyy"))

the parameter in crystal report defined as Date.

thanks.

Parameter Passing In Crystal Report
I am passing parameters to report ,but it is giveing me error "invalid Field ".
do each field have any specific index,or number in the report .I have designed the report already.

Passing Parameter In VB6 To Crystal Report
Hi Babu,
I used code that you gave me but there is a error "205539 :Invalid parameter field name".Can you show me clearly? Thanks in advance!

Passing Parameter To Crystal Report
i am passing a string value from vb code to crystal report. in crystal report i have created this parameter as "Pyyyymm" receiving string value.

the vb code goes like this

report1.parameterfields(0) = "Pyyyymm;" & m_SelSalMnth & ";true"

where m_SelSalMnth contains '2002/10' or like value but it gives me error "can't find SQL Server" and error no. 20599.

i don't know where i am going wrong.

i am adding crystal report thru component and not thru reference i.e. i am using a crystal report control.

Waiting for a quick reply.

diamond

Problem Passing Parameter IN Crystal Report From Vb 6.0
WEll hi to all

I am new user here.........I really need help in my project

My problem is that i have made a project in Vb6.0 and database in Ms Access

Now i make report in Crystal report 9 and by using Wizard Expert

now what i want to do is i want to pass parameter by using my own design
form in Vb6.0 like i want to pass account no so it will display only the result of that account no i don't know that code exactly and please tell me do i need to use parameter option in crystal report or just pass parameter from Vb from

i will really thankful to those people who help me out in this regard

Sorry for poor english

Passing The Parameter To Crystal Report Using ParameterFieldDefinitions
Hi everyone,

I am get the error in assigning the value to the parameter of parameter1 in crystal reports. It is the string parameter type .I tried with setcurrentvalue and also addcurrentvalue mothod. But i can't able to pass the parameter.

Even though i am using
crRepp.EnableParameterPrompting = False
it prompting for the parameters values......

CrystalReport1 is ICRDesigner object

Dim Report As New CrystalReport1
Private Sub Form_Load()
Dim crApp As New CRAXDRT.Application
Dim crRepp As CRAXDRT.Report
Dim crParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim crParamDef As CRAXDRT.ParameterFieldDefinition
Dim crDBTab As CRAXDRT.DatabaseTable

'Open report file
Set crRepp = crApp.OpenReport(App.Path & "ReportTest.rpt")
'Set location of database based on WhatCompany

crRepp.Database.LogOnServer "p2sodbc.dll", "Testpass", "Northwind", "sa", ""
'Set table location to appropriate company server

For Each crDBTab In crRepp.Database.Tables
crDBTab.SetLogOnInfo "Testpass", "Northwind", "sa", ""
Next
crRepp.DisplayProgressDialog = False
crRepp.EnableParameterPrompting = False

'Fill report parameters
Set crParamDefs = crRepp.ParameterFields
For Each crParamDef In crParamDefs
Select Case crParamDef.ParameterFieldName
Case "Parameter1"
crParamDef.AddCurrentValue "eeeeee"
End Select
Next

DoEvents
CRViewer1.PrintReport

Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub

pls help me to come out the problem
Advance thanks

regards
Tamil

Problen In Crystal Report 8 On Parameter Passing
Dear Group Members


Need some help !

I have created a crystal report 8 name as Report1.rpt, I have alsoinserted a parameter field as NAM in this report, Than I have createda form in Vb6 and put a command button on this form and the code haswritten on this command event as



CrystalReport1.ReportFileName = "C:engg
eport1.rpt"
CrystalReport1.ParameterFields(1) = "NAM;INDORAMA;TRUE"
CrystalReport1.Action = 1

The backend is oracle and have aslo setted the Odbc as Cror7 or Cror8



When I run this form and click on command button then a erroroccurs like


Run time error 20599
Can not open sql server



If I not use the parameter field NAM then this for is work properly


I am not getting that I am not using the Sql server then why it isdisplaying this error


I will be highly oblige if any one will send the solution at earliest



Regards



Dk Varshney

Passing Parameter From Text Box To Crystal Report Designer (RDC)
I am new to Crystal Reports. I earlier used Microsoft Data Report but it didnot have the 'Record Number' feature , so I have to re create my reports in Crystal Reports.I am using crystal report 8 designer control ( RDC) for my project on Payroll . I want to create a report which will generate the report based on the month & year.

I have a form containg two combo boxes from where the user will select the month & the year.

I want to pass this to Crystal Report Designer as a parameter.


I used the following query in data report.

select p.empno,e.fname, p.bsal,p.itax,p.netsal,p.mnth,p.yr from emp e, payroll p where e.empno=p.empno and p.mnth= ? and p.yr= ?
order by p.bsal

I used to pass the value for p.mnth & p.yr using the following code in a form which contained the text boxes.

[vbtemp]
option Explicit

Private Sub Command1_Click()
deConsolidated.Command1 cmbMonth.Text, cmbYear.Text
drConsolidated.Show
End Sub

[/vbtemp]

Pls guide me how to pass the parameters from the above combo box to crystal report designer ( RDC)

Thanking you,
Rgds,
Dennis.

Crystal Reports / Passing Paramater To Subreport
I am attempting to call up a report and imposing parameters (date). I have done this often enough, but the difference here is that the report contains 3 subreports. It is in the subreports where I would need the paramaters to go.

Here is the code I am using to call the report. How could I alter this code to impose parameters on subreports within this report?


VB Code:
Dim Response As String        Response = InputBox("Enter Date (m/d/yyyy):", "Enter Date")        'Empty length string is returned when user selects 'Cancel'.    If Response = "" Then        Exit Sub    End If        'Make sure user enters a date.    If IsDate(Response) = False Then        MsgBox "Please enter a date.", vbOKOnly + vbExclamation, "Invalid User Entry"        Exit Sub    End If        '--------Encapslulated code opens cr report--------    Dim Report As New rptBuySchedule    Dim crPDefs As CRAXDRT.ParameterFieldDefinitions    Dim crPDef As CRAXDRT.ParameterFieldDefinition     Set crPDefs = Report.ParameterFields        For Each crPDef In crPDefs        With crPDef            Select Case .ParameterFieldName                Case "SettleDateParm"                    .AddCurrentValue CDate(Format(Response, "mm/dd/yy"))            End Select        End With    Next     Report.EnableParameterPrompting = False    frmRptView.CRViewer1.ReportSource = Report    frmRptView.Show    frmRptView.CRViewer1.ViewReport    '-------------------------------------------------  

Crystal Reports: Passing Values From Subreport To Primary
I have a sub report that has some values in it that I want to use to do some calculations and display the results in my primary report. Is it possible for both reports to exchange values that are saved in variables?

I tried creating a global var in the subreport and putting the value in it but the primary report can't see that global var.

Crystal Report Subreport
Hello,
I am below code to call a report and now insert a subreport but i m unable to understand where i will pass subreport query.the code is:
Dim str1 As String
Dim str2 As String
Private Declare Function CreateFieldDefFile Lib "p2smon.dll" (lpUnk As Object, ByVal fileName As String, ByVal bOverWriteExistingFile As Long) As Long
Public CrystalApplication As CRPEAuto.Application
Public CrystalReport As CRPEAuto.Report
Public CrystalDatabase As CRPEAuto.Database
Public CrystalTables As CRPEAuto.DatabaseTables
Public CrystalTable As CRPEAuto.DatabaseTable
Public dq As New ADODB.Connection
Dim str As String
Public a As New ADODB.Recordset
Public b As New ADODB.Recordset
Private Sub Command1_Click()
str1 = "SELECT a.EMPLOYEE_CODE,a.EMPLOYEE_NAME,a.GPF_DPF_ACCOUNT_NO, b.POST_ID,c.DESIG NATION,c.MAJOR_HEAD,c.SUBMAJOR_HEAD,c.MINOR_HEAD,c. SCHEME_HEAD,c.OBJEC T_HEAD,c.SEGMENT_CODE,c.CHARGED_VOTED,c.DETAILED_HE AD,d.PAY_SCALE_DESC RIPTION,e.DNI,f.DESIGNATION,g.TREASURY_NAME FROM MM_GEN_EMPLOYEE_TRS_SA a,MD_SAL_EMP_POST_SA b,MM_SAL_DDO_POST_SA c,MD_GEN_PAY_SCALE d,MD_SAL_EMPLOYEE_DNI_SA e,MM_GEN_DDO_SA f,MM_GEN_TREASURY_SA g,MD_SAL_EMP_GPF_SA h,MM_GEN_POST_SA i WHERE b.EMPLOYEE_CODE =a.EMPLOYEE_CODE AND c.DDO_CODE = b.DDO_CODE AND c.POST_ID = b.POST_ID AND c.POST_TYPE = b.POST_TYPE AND c.POST_SERIAL_NUMBER =b.POST_SERIAL_NUMBER AND d.PAY_COMMISSION_ID =c.PAY_COMMISSION_ID AND d.PAY_SCALE_ID = c.PAY_SCALE_ID AND e.EMPLOYEE_CODE =a.EMPLOYEE_CODE AND a.gpf_dpf_account_no =h.gpf_dpf_account_number AND h.EMPLOYEE_CODE =a.EMPLOYEE_CODE AND e.ACTIVE_FLAG = 'Y' AND a.active_flag = 'Y' AND b.ACTIVE_FLAG = 'Y' AND c.ACTIVE_FLAG = 'Y' AND a.ddo_code = '0520101001' AND a.ddo_code = f.ddo_code " & _
"AND a.treasury_code =g.treasury_code AND c.post_id = i.post_id and b.employee_code between '052000082' and '052000090' ORDER BY 1 "
If a.State <> 0 Then a.Close
a.CursorLocation = adUseClient
a.Open str1, dq
str2 = "SELECT a.DESCRIPTION,b.EMPLOYEE_CODE,b.AMOUNT FROM MM_SAL_PAY_COMPONENT a,MD_SAL_EMPLOYEE_PAYRECORD_SA b WHERE a.COMPONENT_ID =b.COMPONENT_ID AND a.COMPONENT_FLAG = 'P'AND b.ACTIVE_FLAG = 'Y' AND a.ACTIVE_FLAG = 'Y' ORDER BY 1"
If b.State <> 0 Then b.Close
b.CursorLocation = adUseClient
b.Open str2, dq
CrystalReport2.ReportFileName = "D:Documents and SettingsNitantDesktopProject short123novFor Payreocrd reportReppayrecord.rpt"
PreviewReport CrystalReport2.SQLQuery, CrystalReport2.ReportFileName, "Prehead"
CrystalReport2.PageZoom 900
End Sub
Public Function PreviewReport(ByVal str1 As String, ByVal strReportFile As String, Optional ByVal strReportTitle As String)
Dim str As String
Dim iTemp1 As Integer
'CreateFieldDefFile b, App.Path & "gendetails.ttx", True
Set CrystalApplication = CreateObject("crystal.crpe.application")
Set CrystalReport = CrystalApplication.OpenReport("D:Documents and SettingsNitantDesktopProject short123novFor Payreocrd reportReppayrecord.rpt")
Set CrystalDatabase = CrystalReport.Database
Set CrystalTables = CrystalDatabase.Tables
Set CrystalTable = CrystalTables.Item(1)
CrystalTable.SetPrivateData 3, a
CrystalReport.Preview "testhead", 0, 5, 800, 550
End Function

Private Sub Form_Load()
dq.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=treasury;Password=treasury;Data Source=VB_OraXE"
End Sub

Plz help me out hurry!!!
Nitant Kulshrestha

How Can I Use Subreport In Crystal Report ?
During the time of work with crystal report data in main report is shown properly but data in subreport not display when i am trying to open individual subreport data in subreport display properly what shoud i do ?

Subreport In Crystal Report
I am working with VB6.0 and Crystal Report. I have a subreport in the report footer which I want to hide if there is no detail in it. How can I manage to do this.

Thanks a lot in advance,

Nauj

Refreshing Subreport In Crystal Report
Im using the crystal report control in my project. The code is similar to this coz the actual project is in the office and our internet connection is down, so i have to post this at home:

with MyReport
.connect = "Server=Pdc_Coc; Dsq=ims"
.ReportFileName = app.path & "myreport.rpt"
.selectionformula = selFormula
.printreport
end with

now this code works well but my problem is the subreport doesn't get updated. My main report connects to a server while my subreport connects to a local database. is there a way to refresh it. i tried using the refresh button but the whole report disappeared, and i want the report to get the latest data in the database.

Using Subreport Data In Crystal Report
I have a crystal report with a subreport in it. Is it possible to use data from the subreport to calculate a value that is displayed in the main report?

Insert A Subreport Using Crystal Report
I already create a report and insert a subreport using VB .Net. When I run the report the subreport does not display the required information. Why???

How To Populate The Ttx Subreport In Crystal Report?
Please help me on populating the ttx subreport in Crystal Report?

Filtering Subreport Of Crystal Report
does anybody know how to manipulate a subreport so that it would show only the records related
to a particular field on the main report? i should be establishing some form of linking or filtering
between the subreport and the main report but i don't know how to do it.

btw, i'm trying to do this from within vb and the relationship between the main report to subreport
is one to many (e.g. the customer info on main report and orders on subreport).

thanks in advance.


...........
already found the solution to this.



Edited by - ykdis on 7/21/2004 5:40:08 PM

Insert A Subreport Using Crystal Report
I already create a report and insert a subreport using VB .Net. When I run the report the subreport does not display the required information. Why???

Crystal Report Control And Subreport Problem
I have made a report using Crystal Report 8.5 which has a sub report.

I can view the report properly when opened with Crystal Report software. I can even view the sub report (which is in suppressed mode).

I am now using crystal report control in vb6 to show the report to the user through my application. Though i am able to view the report properly, i face an issue, i dont get to see the subreport

Vb6 Code To Link Crystal Report 8.5 Subreport
Hi,

I have created unlinked crystal report(subreport) & when i call that report through codeing it shows the following error message.

"unable to connect :incorrect session parameter. 20535"

here is my code
CrystalReport1.WindowState = crptMaximized
CrystalReport1.DataFiles(0) = App.Path & "dbpayroll.mdb"
CrystalReport1.ReportFileName = App.Path & "
eports emppayslip.rpt"
CrystalReport1.DiscardSavedData = True
CrystalReport1.Password = Chr(10) & "abc"
CrystalReport1.SelectionFormula = ""
CrystalReport1.Action = 1

pls anybody help me in this code...

Someone Please Give Me An Example Of Code For A Crystal Report With A Subreport
I really need the above example using the designer in VB plz.

Crystal Report Subreport With SQL Database Not Logging In.
Hello All,

I am trying to display a crystal report that has 2 different databases. The main report only uses an Access database. The subreport uses an SQL database that requires an ID and Password and the same Access DB but a different table. I do not need to pass any parameters to the report, I just want to show it

When I try to show the Crystal report I get an error:
Quote:Login Failed
Details: ADO Error Code: 0x8004034d
Source: Microsoft OLE DB Provider for SQL Server
Description: Login failed for user 'sa'.
SQL State: 42000
Native Error: 18456

How can I pass the password to the sql database in the subreport.

Here is my current Code:
Code:Dim oApp As New CRAXDRT.Application
Dim oRpt As CRAXDRT.Report

Private Sub ExitBut_Click()
    Set oApp = Nothing
    Set oRpt = Nothing
    Unload CrystalFrom
End Sub

Private Sub Form_Load()
            
    'define the crystal report to be used
    Set oApp = New CRAXDRT.Application
    Set oRpt = oApp.OpenReport(App.Path & "ReportsSpecialItemsTest.rpt")
            
    'Display the report
    CRViewer91.ReportSource = oRpt
    CRViewer91.ViewReport
    CRViewer91.Refresh
    
End Sub


I have tried working with the LogOnServer method but I get the same message. (Probably because I am doing it wrong).

Dan





Edited by - dvmc on 9/26/2005 4:54:10 PM

How To Set Subreport Data Source On A Crystal Report
Hello!


I'm using Crystal Report 6.0 with Cristal Report Viewer and need to set a new data source for the report and its subreport.

How to use SetDataSource from the Report and its Subreport to my Recordset. I know what to do for an report without a subreport but for the two, no.


Thanks

Crystal Report : Changing Subreport Database Connection
how to Change main report and Subreport database server connection
and view them In CRViewer ?

thanks

How Can I Suppress Subreport If It Doesn't Have Data . (Crystal Report)
In Crystal report,I set the section that suppress if it blank,but it 's not work.I would like to know how to write condition to suppress supreport,If it doesn't have any record.

Passing Parameter To Crystal
Hey,
I have an application developed with Visual basic 6 and Crystal Reports 9.
I am trying to pass a parameter to a crystal report and just can't seem to get it right.
I am opening the report (the report opens well but loads the saved data in the report) with the following code:

Code:
Module1.OpenDatabase

Dim s_myNumber As String
s_myNumber = Me.txtPurchaseOrderNumber.Text

Dim s_sql As String
sql = "...............WHERE 'POR_PURCHASE_ORDERS'.'ORDER_NUMBER'='" & s_myNumber & "'"

Dim rst As New ADODB.Recordset
rst.Open sql, conn

If Not (rst.EOF) Then
Dim myReport As New CrystalReport1
myReport.Database.SetDataSource (rst)

Dim frm As New Form2
frm.Show
frm.CRViewer91.Refresh
frm.CRViewer91.ReportSource = myReport
frm.CRViewer91.ViewReport
End If
Screen.MousePointer = vbNormal
The parameter "OrderNo" is set to "equal to 0000033960" in the report. What I want to do is pass my own parameter from VB6 and I do not want the pop-up screen that asks for the parameter value to show.

Hope you can help
Thanks

Passing A Parameter To A Crystal Rep
Greetings Babu,
I am using a dataset that consists of a SQL Server Stored procedure with a parameter, I would like to have a bottun on a windows form in my C# app that the user would press to pass in a param, do you know how I can pass in a param to my crystal report? EVerytime I add a param, and run my app, this dialog box pops up and asks for the parameter, i don't want this to happen because I want my text field to take care of passing hte param in? Could you provide any advice?

Thanks!!!
The TreeofWoe

Changing Crystal Report And Subreport Database Name From Visual Basic Code
What visual basic code i should write to change the database of the reports
before showing it??

Here is the code i tried ..

Public rpta As New CRAXDRT.Application
Public rptR As CRAXDRT.Report
Set rptR = rpta.OpenReport(rep1.rpt")

Dim i As Integer
With rptR.Database
.ConvertDatabaseDriver "pdssql.dll", True
.LogOnServer "pdssql.dll", srvr, dtbs, dtbsuid, dtbspwd
For i = 1 To rptR.Database.Tables.Count
.Tables(i).SetLogOnInfo srvr, dtbs, dtbsuid, dtbspwd
Next
End With

It's changing in Main report but How to cahnge it in subreport ????

Thanks in advance

Regards,
Sukhadev

Crystal Reporting And Parameter Passing
I know that it is possible to pass runtime parameters to Crystal. I was just wondering how one would do it a to for example set a textfield object from vb6.

Also my report contains subreports based on saved queries. Any idea if i would be able to change the actual queries at runtime?

Thanks in advance

Crystal Reports Parameter Passing
I want to be able to run a crystal report from visual basic 6.0. I made a report, but it reports all data from the access database. I want to be able to pass a parameter to the crystal report from the vb app and then have the report pull the data linked to that parameter from the database and fill in the correct fields on the report. Is this possible or do I have to make all of the fields on the report parameter fields then pass the correct data to it from the vb app?

Passing Parameter To Crystal Reports
I looked on the Crystal reports site and got some sample code for Passing parameters to crystal reports but it doesn't work. VB doesn't like the .GetItemByName. This option doesn't come up if I just type the '.' after crxReport.ParameterFields so I don't think I have it or don't know if you can do it another way.

Thanks for any help

Passing Parameter Value To Crystal Reports
I have a stored procedure that accepts 2 input parameters.

I designed a report and specified default values for this from crystal reports and it works well, but now I want users to be able to specify values at run time from VB6 environment but all I get is an empty report, I don't know what the problem is, help.

This is the code I used

rpt.StoredProcParam(0) = Trim(Me.cboReportCode.Value)
rpt.StoredProcParam(1) = Me.cboFromPayPeriod.Value
rpt.Action = 1

[SOLVED] Passing Parameter To Crystal
Hey,
I have an application developed with Visual basic 6 and Crystal Reports 9.
I am trying to pass a parameter to a crystal report and just can't seem to get it right.
I am opening the report (the report opens well but loads the saved data in the report) with the following code:
Code: Module1.OpenDatabase
        
        Dim s_myNumber As String
        s_myNumber = Me.txtPurchaseOrderNumber.Text
       
        Dim s_sql As String
        sql = "...............WHERE 'POR_PURCHASE_ORDERS'.'ORDER_NUMBER'='" & s_myNumber & "'"
        
        Dim rst As New ADODB.Recordset
        rst.Open sql, conn
        
        If Not (rst.EOF) Then
            Dim myReport As New CrystalReport1
            myReport.Database.SetDataSource (rst)
            
            Dim frm As New Form2
            frm.Show
            frm.CRViewer91.Refresh
            frm.CRViewer91.ReportSource = myReport
            frm.CRViewer91.ViewReport
        End If
        Screen.MousePointer = vbNormal

The parameter "OrderNo" is set to "equal to 0000033960" in the report. What I want to do is pass my own parameter from VB6 and I do not want the pop-up screen that asks for the parameter value to show.

Hope you can help
Thanks



Edited by - Nasty on 10/23/2005 4:21:20 AM

Parameter Passing+ Crystal Reports
 Hi,
 
    I want a command button on my VB form to invoke the report(report1) & prompt the user to enter a parameter value on the basis of which the data will be retrived.

 Kindly help............its urgent

Crystal 20553 Error When Passing Parameter
I am passing 10 parameters to a stored procedure to run a crystal report. I can plug the parameters into crystal or run the SP in query analyzer and it works fine.

However...

If I try to run the report from VB.. It blows up saying

"Error in file : Report.rpt, Invalid parameter name"
Error 2553

HELP.. Anything I can check or do?

Passing Datetime Parameter To Crystal Reports
i have a crystal report that uses a stored proc and has a parameter that's defined as DateTime. this is the code i'm using to pass the parameter in:


VB Code:
pReport.ParameterFields(i).AddCurrentValue CDate(strParams(i - 1))


but this seems to pass in an empty value (i know that strParams(i - 1) has the value "01/01/01"). if i use Format instead of CDate, if just returns a type mismatch error.

has anyone else experienced this?

Passing A Multiple Value Parameter To Crystal Reports 8
I have designed an invoice as a CR8 Report. It works fine on its own and when I call it in my VB6 app via CrystalReport control.

In my app, I have a grid to list invoices so users can select various invoices and then click on the cmdPrint. I enhanced my report by setting InvoiceNo as a GroupField so that I could pass it multiple InvoiceNos and it runs fine within CR but only accepts single value parameter from VB6.

I tried passing it a comma-delimited string but it wouldn't work, it won't accept an Integer array either.
I've searched this site, Google, and the web but I can't find a VB6-specific example.

Code:Private Sub cmdPrint_Click()
    On Error GoTo ErrHandler
    
    Dim TaxInvNos As String
    Dim x As Integer
    
    If MSFlex2.TextMatrix(1, 1) <> "" Then
        If MsgBox("Do you want to Print the Invoice?(Yes/No)", vbYesNo, gstrMessage) = vbNo Then Exit Sub
        
        For x = 1 To MSFlex2.Rows - 1
            If MSFlex2.TextMatrix(x, 13) = "x" Then TaxInvNos = TaxInvNos + MSFlex2.TextMatrix(x, 0) & ","
        Next x
        If TaxInvNos <> "" Then
            TaxInvNos = "(" & mID(TaxInvNos, 1, Len(TaxInvNos) - 1) & ")"
            Call procreport(TaxInvNos)
        End If
    End If

    Exit Sub
ErrHandler:
    MsgBox Err.number & ":" & Err.Description
End Sub

Private Sub procreport(taxinvno As String)
    On Error GoTo ErrHandler

    'The commented out lines are the other option I tried for the Long array.
    'Dim inv() As Long
    'inv = Split(taxinvno, ",")
    
    CrystalReport1.Connect = cnn
    CrystalReport1.ReportFileName = App.Path & "
eportsInvoice2.rpt"
    CrystalReport1.ParameterFields(0) = "INVNO;" & taxinvno & ";True"
    'CrystalReport1.ParameterFields(0) = "INVNO;" & inv() & ";True"
    CrystalReport1.Destination = crptToWindow
    CrystalReport1.WindowState = crptMaximized
    CrystalReport1.WindowShowExportBtn = True
    CrystalReport1.WindowShowPrintBtn = True
    CrystalReport1.WindowShowPrintSetupBtn = True
    CrystalReport1.Action = 1
    CrystalReport1.Reset
    
    Exit Sub
ErrHandler:
    MsgBox Err.number & " : " & Err.Description
End Sub

I really need help.

GoodGuy
Experience is a bad teacher for its exams precede its lessons.

Passing Parameter To Access Report
Hmmm... it's late in the day and brain has stopped working.

I have a report running off a query in Access 2000. I want to print this report from Visual basic except change the criteria for the query b4 printing. Clues gratefully appreciated.

Scrooge

Passing Report Parameter Values
Hi there,

i have designed a report in Crystal repots using Sql Server Stored procedure. i need to pass the parameter value's to the report thru VB.

I tried CrystalReport1.ParameterFields(0) = "fromDate=date(2001,11,1)"
but it gives a error Invalid formula name , i tried attaching {@fromdate} ,{?@fromDate} still the same error creeps up..

Did anyone tried similar thing?.

Your help is appreciated.

Thanx

Parameter Passing In Data Report
Hi All,

     I have created a Data report for listing all the party details, who's party name is between any two alphabets. My query for the command is

Code:
SELECT vchPartyCode, vchRepCode, vchPartyName, vchPartyAddr1, vchPartyAddr2, vchPartyAddr3, vchPartyPincode, vchPhone FROM tbPartyMaster WHERE (vchPartyName >= ? AND vchPartyName <= ?) ORDER BY vchPartyName


My problem is if am passing the parameter as 'a' and 'a' it is not displaying anything. if the parameters are 'a' and 'b' it is displaying only for a alone, it is not displaying the for 'b'. What might be the problem.

  Please guide me.

 Thanks



   

Crystal 8.5: Passing Detail-a Field To Detail-b Subreport
Greetings,
I use CR8.5,VB6 sp6
and 2 DB's (SQL Srv 2k and Oracle 10).
I am constructing a report in cr.
This report should simply present the details of items inside a store. (from SQL Srv)
that was simple.

furthermore, by checking the value of each item's field there is a possibility to need some more details for this item. So i created a second details section (details-b), placed a formula on supression so as to show this section when the value states that we need to show more on this item. this works fine till here (it seems so).
these extra details however derive from the tables from another database (oracle). so i figured I need a subreport inside my details-b section.
this subreport as it seems, needs the item code from details-a in order to populate properly.
this is where my problem rises.
the subreport does not filter its data according to the item code.
below is my code:
if u find a mistake in my logic or code or have any advice, please do.
thanxs in return,

Code:
Dim crpParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim crpParamDef As CRAXDRT.ParameterFieldDefinition
Dim crxApp As CRAXDRT.Application
Dim crxRpt As CRAXDRT.Report
Dim crxTable As CRAXDRT.DatabaseTable

Dim sql, TABLE_NAME As String
Dim crRS As New ADODB.Recordset
crRS.CursorLocation = adUseClient

sql = "SELECT * FROM " & TABLE_NAME & " ORDER BY priority"
crRS.Open sql, cn, adOpenKeyset, adLockOptimistic, adCmdText

'set our report objects
Set crxApp = New CRAXDRT.Application
Set crxRpt = crxApp.OpenReport(App.Path & "/reports/pickerList.rpt", 1)

For Each crxTable In crxRpt.Database.Tables
crxTable.SetLogOnInfo "server", "dbname", "user", "pswrd"
Next

'remove any saved data
crxRpt.DiscardSavedData

'set parameter fields (headers etc.)
crxRpt.EnableParameterPrompting = False

Set crpParamDefs = crxRpt.ParameterFields

For Each crpParamDef In crpParamDefs
With crpParamDef
Select Case .ParameterFieldName
Case "pickerCode"
.ClearCurrentValueAndRange
If IsNull(cRS.Fields("code")) Then cRS.Fields("code") = ""
.SetCurrentValue CStr(cRS.Fields("code"))

Case "pickerName"
.ClearCurrentValueAndRange
If IsNull(cRS.Fields("lastname")) Then cRS.Fields("lastname") = ""
If IsNull(cRS.Fields("firstname")) Then cRS.Fields("firstname") = ""
.SetCurrentValue cRS.Fields("lastname") & " " & cRS.Fields("firstname")
End Select
End With
Next

''SUBREPORT STUFF
Dim CrSections As CRAXDRT.Sections
Dim CrSection As CRAXDRT.Section
Dim CrReportObjs As CRAXDRT.ReportObjects
Dim CrSubreportObj As CRAXDRT.SubreportObject
Dim CrSubreport As CRAXDRT.Report

'first get a variable representation of all sections
Set CrSections = crxRpt.Sections

'loop all sections, they start at one
Dim x, y As Integer

For x = 1 To CrSections.count
'get the individual section
'get the individual report objects
Set CrSection = CrSections.Item(x)
Set CrReportObjs = CrSection.ReportObjects

'now loop all objects found
For y = 1 To CrReportObjs.count
'if we find a subReport, act accordingly
If CrReportObjs.Item(y).Kind = crSubreportObject Then
'set our first subReport Object variable
Set CrSubreportObj = CrReportObjs.Item(y)
'now assign the second object instance to the OpenSubReport method
Set CrSubreport = CrSubreportObj.OpenSubreport

Dim rs1 As New ADODB.Recordset
rs1.CursorLocation = adUseClient
sql = "SELECT *" _
& " FROM parts" _
& " INNER JOIN details" _
& " ON parts.id = details.parid" _
& " AND parts.iteid = details.iteid" _
& " INNER JOIN material" _
& " ON material.id = parts.iteid" _
& " AND material.id = details.iteid" '_
& " WHERE atlantis.material.Id = " & getITEIDfromBARCODE(crRS.Fields("barcode"))
rs1.Open sql, cnOracle, adOpenKeyset, adLockOptimistic, adCmdText
'connect to oracle
For Each crxTable In CrSubreport.Database.Tables
crxTable.SetLogOnInfo "service name", , "user", "passwrd"
Next

CrSubreport.DiscardSavedData
CrSubreport.Database.SetDataSource rs1
End If
Next 'end for y

Next 'end for - x

'bind the new recordset
crxRpt.Database.SetDataSource crRS

crxRpt.PrinterSetup False
crxRpt.PrintOut False

Passing The Parameter To The Data Report Header
Dear Friends,

I have a form which contains 2 combo boxes

1. cmbMonth
2. cmbYear

I want to pass the text it contains to the Data Report Header

How to pass the parameter to the report header in Data Report ie cmbMonth.text & cmbYear.text

I want to use the above in the Account Credit Statement which i prepare on the monthly basis & I require to show the month in the report.


Pls help me,

Thanks,

Dennis.

Passing Parameter To Cyrstal Report From VB Code
I have created a report in Crystal Report which uses two parameter Fields FromDt and ToDt.. I am calling that report from my vb application using a Crystal Control.. I pass the parameter as follows ...

Cry.ParameterFields(0) = "FromDt;" & Format(dtpFrom.Value, "DD/MM/YYYY") & ";False"

Cry.ParameterFields(1) = "ToDt;" & Format(dtpTo.Value, "DD/MM/YYYY") & ";False"

It works fine.. But the problem is while running the report it promts for Parameters even if I am pasing it through code...

Can any one help me... I am waiting for some one to gikve me respose...

Thanks in Advance

Copyright © 2005-08 www.BigResource.com, All rights reserved