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




Passing Parameters To Crystal Report From Vb6


I'm trying to run a crystal report and generate a .csv file from VB6. I'm passing parameters to crystal report but it prompts me to type in the parameters. I don't want the users to type it in but rather pass it thru variables. Here is a piece of my code:

eomCurrentStart = Year(Date) & "/09/01"
eomCurrentEnd = Year(Date) & "/09/01"

With CrystalReport1
.Connect = strconnLive
.ReportFileName = "M:ReportsEOMRenewals.rpt"
.Destination = crptToFile
.PrintFileType = crptCSV
.ParameterFields(0) = "@BeginDate;" & eomCurrentStart & ";True"
.ParameterFields(1) = "@EndDate;" & eomCurrentEnd & ";True"
.PrintFileName = strFilePath & "Test.csv"
.DiscardSavedData = 1
.Action = 1
End With

Any help would be appreciated.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Passing Parameters To Crystal Report
How do I pass parameters to crystal report?

Passing Parameters To Crystal Report From VB6
I'm trying to run a crystal report and generate a .csv file from VB6. I'm passing parameters to crystal report but it prompts me to type in the parameters. I don't want the users to type it in but rather pass it thru a variable. Here is a piece of my code:

eomCurrentStart = Year(Date) & "/09/01"
eomCurrentEnd = Year(Date) & "/09/01"

With CrystalReport1
.Connect = strconnLive
.ReportFileName = "M:ReportsEOMRenewals.rpt"
.Destination = crptToFile
.PrintFileType = crptCSV
.ParameterFields(0) = "@BeginDate;" & eomCurrentStart & ";True"
.ParameterFields(1) = "@EndDate;" & eomCurrentEnd & ";True"
.PrintFileName = strFilePath & "Test.csv"
.DiscardSavedData = 1
.Action = 1
End With

Any help would be appreciated.

Passing Parameters From VB To Crystal Report
Hello, Im new to Crystal Report and VB and i have some questions regarding CR.
Just as bshaen noted earlier, we need to go through all the process in connecting the database once we open CR. Does it mean that we left CR as a blank report? I need to do a report where i have to pass all the user input from VB to crystal report viewer. How can i make sure that all the parameters that i passed is in the correct position?One more question : is there any other method besides dataset?

Any help is very much appreciated
Thanx in advance =)

Passing Parameters To Crystal Report (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.

[highlight=VB]

option Explicit

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

[vbcode]

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

Thanking you,
Rgds,
Dennis.

Passing Parameters To A Crystal Report
When using the RecordSlectionFormula
Code:
CReport.RecordSelectionFormula = "{Table1.Date} >= #" & DateFrom & "# And {Table1.Date} <= #" & DateTo & "#"
I want the DateFrom and the DateTo, that the user specified, to appear on the top of my Report. Does anyone know how to do this.

Using: CR Professional v8.5; MS Access 2000; VB 6.0

Passing Parameters To Crystal Report 9
How to Pass the parameters to the Crystal Report 9 through VB 6 at runtime?

RE: Passing Parameters To Crystal Report From VB6
Hi
I would apprechiate some help with this one.

created my report with CR10, fine....

but, how do i send parameters to it from my vb application?

any pointers would be great!

thanks



Edited by - Afy on 1/29/2005 1:29:03 PM

Passing Parameters From Vb .net To Crystal Report
I can't get out of this problem... I have seen all recent posts on this topic but it seems there is no way...

I built a report who show me some data i needs... I also created a textbox who allows me to search for some records in the reports...

After the search is completed, I'd like to view the parameter inserted in the textbox on the report but i still can't do that...

So, i tried to create a simple passing parameter code in the vb form but it seems that it's ignored by the program because when i open the report it shows me a windows which asks me for the value of parameter...

Here is the code:

        Dim crParameterFieldDefinitions As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions
        Dim crParameterFieldDefinition As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition
        Dim crParameterValues As New CrystalDecisions.Shared.ParameterValues()
        Dim crParameterDiscreteValue As New CrystalDecisions.Shared.ParameterDiscreteValue()
        Dim crReport As New CrystalReport1()
        'Set Number Parameter
        'Set the discrete value
        crParameterDiscreteValue.Value = CInt(5)
        ' Access the first parameter field definition
        crParameterFieldDefinitions = crReport.DataDefinition.ParameterFields
        crParameterFieldDefinition = crParameterFieldDefinitions.Item("param")
        ' Add parameter value
        crParameterValues = crParameterFieldDefinition.CurrentValues
        crParameterValues.Add(crParameterDiscreteValue)
        ' Apply the current value to the parameter definition
        crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

It's obvious that i have also created a numeric parameter field in crystal report whose name is "param"...

PLEASE HELP ME!!!!

THANKS!!!!!!!!!!!

Passing Parameters To Crystal Report 9
Hi!

This will be quick...i tried using both functions to pass parameters to my reports.

varCR = PESetNthParameterField(intJobHandle, i, TCrystalParam)

or

varCR = crPESetNthParameterField(intJobHandle, i, .ValueType, .DefaultValueSet, .CurrentValueSet, .Name, .Prompt, .DefaultValue, .CurrentValue)

They worked fine. But all of a sudden, the parameters aren't passed anymore therefore prompting me for the values of the parameters, which shouldn't happen. What's happening here??

I confirmed that it wasn't passed to the report by using 'PEGetNthParameterField'.

This is urgent guys so any kind of help is a big one. thanks!

Passing Parameters To A Report Via CRViewer /Crystal Report 7
hi out there,
I've got following problem: I'm working with a CRViewer to display Reports in my Progam. These Reports have Parameterfields. Normally the CRViewer displayes its own Dialog to input the Parameters. But I have to show my own Dialog in which I group parameters in a logical way. So far, so fine. This works perfect. But now I have to pass the parameters being inputed into my Dialog to the Report via CRAXDRT.Report when the OK-Button is pressed. I don't found a SetCurrentValue-Method like in CRPEAuto.Report. In the other way, if I use the method CRAXDRT.Report.ParameterFieldDefinitions.Item(index).AddCurrentValue

nothing happend. Does anyone have a hint or idea how I can write my parameters into my reports via CRAXDRT.Report.ParameterFieldDefinitions

?

Thanks in advance

Akademos

Passing Parameters To An Executable Crystal Report
I have a Crystal Report that is a stand-alone executable. The Report needs parameters passed to it, but I'm not sure how to do that when the report is an executable. I call the report through Shell, so can I pass the parameters on the command line?

Code:
'Like This?:
Shell App.Path & "MyReport.exe param1, param2", vbNormalFocus
Anyone have any ideas?

Problems Passing Parameters To Crystal Report
I have visual basic 6.0 and I need an example how pass a parameter to crystal report. I need to know what I need colocate in visual basic and what I need to colocate in crystal report. I suppose that the important is that crystal doesn't ask the parameter because it will recieve the information of the visual basic.

Passing Crystal Report Parameters Using Visual Basic
Hi There,

I am developing a small module for displaying the Price Catalog based on the Inventory Category.
The Crystal Report I have developed is in 8.5 and now am trying to call the same from Visual Basic.
I have created two Parameter fields in Crystal Report (StartCategory and EndCategory).
When I Preview Crystal Report, it prompts me for the Value of the Parameter field and display the
Report as per the selected Citeria, but when the same does not work for Visual Basic.

In Visual Basic, I have created two combo box, where in the User will specify the Start Category and End Category.
When i click on display button, the report is displyaed on the screen but with no data???

Could you please guide me as to how can i comeplete this small module?

Bst Rgds
                

Passing Parameters To Stored Procedure To Crystal Report RPT At Runtime
Hi all,

Can any tell me how to pass parameters to a stored procedure to RPT atruntime in VB? I am using Crystal Reports 8.5 and VB6

I have the following code, the stored procedure "spGetApptLoadingDaily"has one parameter, it keep asking me to select a recordset everytime Irun it (prompt me for a table name / sql). How can I get rid of thedialog box ?



adocomm.CommandText = "[spGetApptLoadingDaily]"
adocomm.CommandType = adCmdStoredProc
adocomm.Execute , 100

Report.Database.AddADOCommand Conn, adocomm
Report.Sections("D").AddFieldObject "{ado.FullName}", 750, 5

CRViewer1.ReportSource = Report
CRViewer1.ViewReport



Thanks and Regards,

KUEK Joe Sern

Passing Parameters From Crystal To VB6
Hi All,

I am trying to write a small program that takes an invoice number entered into an ERP system, prints an invoice using Crystal Report V8.5 and updates an SQL database (SQL 2000) to say that that invoice has been printed.

The problem I am having is passing the Parameter from the line of code that prints the invoice to the SQL select statement that updates the field in the database.

This is the code as it stands:

------------------------Start Code------------------------

Dim Report As New CrystalReport1
Dim invNo As String

Private Sub Form_Load()
Screen.MousePointer = vbHourglass
Report.Database.LogOnServer "p2sodbc.dll", "server", "database", "user", "password"
Report.ParameterFields(1).AddCurrentValue (Command)
invNo = Report.ParameterFields(1)
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault

Dim CN As ADODB.Connection
Set CN = New ADODB.Connection
Set cnMyConnection = New ADODB.Connection
CN.Open "DSN=table;" & _
"Uid=User;" & _
"Pwd=password"

CN.Execute "Update MAX112albr.maxmast.oehdr set oehdr_approved = 'printed' where oehdr_ordnum = invNo" '(This is where I need the parameter)

CN.Close
Set CN = Nothing

End Sub
----------------------- End Code --------------------------------
The error I am getting is "object doesn't support this property or method".

I have spent three days working through the help functions, three books and several websites (of which this one is the best) and am still at a loss.

Any hints or shoves in the right direction would be gratefully appreciated.

Simonl (nomis)

Passing Parameters To Crystal
Hi

I have a problem passing a range parameter to Crystal. A single parameter is not a problem so far. I tried the following command but are confused what is needed:

Report.ParameterFields(1).AddCurrentRange(txttext(0).text, txttext(1).text)

But there is a rangeinfo variable. Original formula is:
...AddCurrentRange (start,end,rangeInfo as CRRangeInfo) = ????

I would appreciate any help with this statement.

Thanx

Passing Parameters To Crystal In VB
I was wondering if anyone knows where I can find the numberic values associated with the ValueType property of the ParameterFieldDefinitions class in the Crystal Report Designer Run Time Library (CRAXDRT) object. I need to create my own enum of those ValueTypes so I can write a Case statement. I've looked through the Crystal Knowledge Base but I can't find them. I would appreciate it if anyone has any insight.

Thanks!

Passing Parameters To Crystal Reports
Hi guys..hope you can help with this one.

My interface is basically a bunch of checkboxes. The user selects the ones he/she wants to see in a report. Does anyone know, how can I pass the selected items to Crystal Reports?

**RESOLVED** Passing Parameters From VB 6.0 To Crystal 8.0
I have found a ton of posts on this subject but none which clearly answer my question.

This is the code I am using to call on my Crystal Report:

Private Sub mnuView2_Click()

'Run Report.
Screen.MousePointer = vbHourglass
frmRptView.Show
frmRptView.CRViewer1.ReportSource = rptWriteUp
frmRptView.CRViewer1.ViewReport
Screen.MousePointer = vbDefault

End Sub

frmRptView is a form I am using to view all of my Crystal Reports.

I have a parameter in my crystal report {?WU_id}. I have a text box (in the VB form from which I am calling on the CR Report) which has an identifier (txtWU_id) which I would like to use as my parameter for CR Reports.

Does anyone know how to pass this parameter from VB without prompting the user??

Passing Parameters From VB To Crystal Reports
I think that you have to send the parameters to the store, not to crystal.

Passing Parameters To Crystal Reports 6
Hi again!

I want to find out how to pass parameters to Crystal Reports from a SQL database through VB 6. I am doing reports for my app and I need to know where to begin.

Sample code would be great if you have it. Thanks in advance for your help.

Doubt In Passing Parameters In Crystal 9.0
hi ,


      i'm working in vb 6.0, access and crystal report 9.0. i created the reports by passing parameter values in reports itself.
But, it runs with vb 6.0 , it again open a dialog box in cr format. Then after entering the name , it displays the value.

i wnt to pass the values within the vb code & it shouldn't ask me in runtime. plz help me.

vikramjb : topic moved to the reporting section






Edited by - vikramjb on 12/20/2005 4:18:37 AM

VBA Passing Parameters To Crystal Reports
I have an application in VBA (Excel2000) which opens and exports a report from Crystal Reports (8.5). The Crystal has a Parameter Field which I to update from within the VBA application in Excel. Does any one know how to pass the value of a variable in VBA to the Paremeter field in Crystal

I'd appreciate any help



Thanks and regards

Michael Bond

Passing Parameters To Crystal Reports
Please help in passing the parameters to crystal reports.

Passing Parameters From Vb To Crystal By Sel Selectionformula Method
Hi people

How can I send some parameters that I don't have in a database, only in my form to crystalreports??
I heard about selectionformula but it didn't work, I created a blank formula in the crystal and iused its name in vb as the exmaple can show:

...
myreport.selectionformula="{Myformula}=' " & variable & "'"
...

Is this good?? How can I solve this


Thanks

Crystal Reports Xi And Vb6 Passing Date Parameters
i want to make a report base on between Date1 and Date2 from DTPicker of a VB6 program. How can i pass these values to crystal reports 11?

Passing Parameters To The Data Report
How can I pass parameters when I use the Data Report? For example I have a data base command that I use to find the records for a certain day. I would like to send the day to the command to run a Data Report for that day.

Passing Parameters To Data Report
URGENT.. need to finish this today..


Hi guys,
I m using Data Report in Vb6 to generate my reports which are in my access database.
The problem i m havin is i dont know how to pass parameters from vb to my access view.

here is the SQL code that i used in my access

ItemMovement:
Code:
PARAMETERS CodeFrom IEEEDouble, CodeTo IEEEDouble;
SELECT I.ItemLookupCode, I.Description, Sum(TE.Quantity) AS SumOfQuantity, Sum(TE.Total) AS SumOfTotal, I.LastSold, I.Cost, I.Quantity AS OnHand, I.Quantity*I.Cost AS TotalCost, I.LastReceived
FROM Item AS I, TransactionEntry AS TE
WHERE I.ID BETWEEN CodeFrom AND CodeTo
GROUP BY I.ItemLookupCode, I.Description, I.LastSold, I.Cost, I.Quantity, I.Quantity*I.Cost, I.LastReceived;


The other problem is i dont see my view (ItemMovement), in the drop down box in the property of the command in the data environment.

So could you guys please help me.

Thanks in advance..

Crystal, Select Statement And Passing Fields To CR Parameters
Hi,

I am trying to use parameters in CR to build a report. I have a select join statement and need to show on the report 5 fields that follow the select bit in the sql statement. I have tried a number of things but can't seem to see how to solve this.

On my report inside the VB IDE, I have the 5 fields laid out as parameters. I have no formula fields and when I click Select expert over one of those parameter fields I get just a dialog box with a greyed out OK button.

Heres the code I have so far. Believe it is all wrong because errors show up when the form is trying to show the CRViewer. Any help on this would be breatly appreciated.

Regards,

Davos.
------------------
Set AdoRSCustSum = New ADODB.Recordset
Set frmDet = New CrystRep2Form

strSql = "SELECT C.CustomNber, CB.PaymDate, CB.PaymRef, CB.PaymNotes, " & _
"CB.PaymAmnt FROM CustomerBilling As CB INNER JOIN Customers As C ON " & _
"CB.CustID = C.CustID WHERE PaymDate >= #" & FormatDate(Format(dateSlsh1, "mm/dd/yyyy")) & _
"#" & " AND PaymDate <= #" & FormatDate(Format(dateSlsh2, "mm/dd/yyyy")) & "#"
'debug.print strSql
AdoRSCustSum.Open strSql, myDbCon, adOpenKeyset, adLockOptimistic
Do Until AdoRSCustSum.EOF
With CustSumm
.DiscardSavedData
.EnableParameterPrompting = False
If Not IsNull(AdoRSCustSum![CustomNber]) = True Then
.ParameterFields.GetItemByName("CustID").AddCurrentValue CStr(AdoRSCustSum![CustomNber])
End If
If Not IsNull(AdoRSCustSum![PaymDate]) = True Then
.ParameterFields.GetItemByName("PaymDate").AddCurrentValue CStr(AdoRSCustSum![PaymDate])
End If
If Not IsNull(AdoRSCustSum![PaymRef]) = True Then
.ParameterFields.GetItemByName("PaymRef").AddCurrentValue CStr(AdoRSCustSum![PaymRef])
End If
If Not IsNull(AdoRSCustSum![PaymNotes]) = True Then
.ParameterFields.GetItemByName("PaymNotes").AddCurrentValue CStr(AdoRSCustSum![PaymNotes])
End If
If Not IsNull(AdoRSCustSum![PaymAmnt]) = True Then
.ParameterFields.GetItemByName("PaymAmnt").AddCurrentValue CStr(AdoRSCustSum![PaymAmnt])
End If
End With
If AdoRSCustSum.EOF = False Then
AdoRSCustSum.MoveNext ' Move to next record
End If
Loop
AdoRSCustSum.Close
Set AdoRSCustSum = Nothing

With frmDet
loadMe = True
.CRViewer91.ReportSource = CustSumm
frmDet.CRViewer91.ViewReport
Call WaitTimer(3)
frmDet.CRViewer91.Refresh
frmDet.Show
End With
Set CustSumm = Nothing
Set frmDet = Nothing

Crystal, Select Statement And Passing Fields To CR Parameters
Hi,

I am trying to use parameters in CR to build a report. I have a select join statement and need to show on the report 5 fields that follow the select bit in the sql statement. I have tried a number of things but can't seem to see how to solve this.

On my report inside the VB IDE, I have the 5 fields laid out as parameters. I have no formula fields and when I click Select expert over one of those parameter fields I get just a dialog box with a greyed out OK button.

Heres the code I have so far. Believe it is all wrong because errors show up when the form is trying to show the CRViewer. Any help on this would be breatly appreciated.

Regards,

Davos.
------------------

VB Code:
Set AdoRSCustSum = New ADODB.RecordsetSet frmDet = New CrystRep2Form strSql = "SELECT C.CustomNber, CB.PaymDate, CB.PaymRef, CB.PaymNotes, " & _    "CB.PaymAmnt FROM CustomerBilling As CB INNER JOIN Customers As C ON " & _    "CB.CustID = C.CustID WHERE PaymDate >= #" & FormatDate(Format(dateSlsh1, "mm/dd/yyyy")) & _    "#" & " AND PaymDate <= #" & FormatDate(Format(dateSlsh2, "mm/dd/yyyy")) & "#"'debug.print strSqlAdoRSCustSum.Open strSql, myDbCon, adOpenKeyset, adLockOptimisticDo Until AdoRSCustSum.EOF    With CustSumm    .DiscardSavedData    .EnableParameterPrompting = False    If Not IsNull(AdoRSCustSum![CustomNber]) = True Then        .ParameterFields.GetItemByName("CustID").AddCurrentValue CStr(AdoRSCustSum![CustomNber])    End If    If Not IsNull(AdoRSCustSum![PaymDate]) = True Then        .ParameterFields.GetItemByName("PaymDate").AddCurrentValue CStr(AdoRSCustSum![PaymDate])    End If    If Not IsNull(AdoRSCustSum![PaymRef]) = True Then        .ParameterFields.GetItemByName("PaymRef").AddCurrentValue CStr(AdoRSCustSum![PaymRef])    End If    If Not IsNull(AdoRSCustSum![PaymNotes]) = True Then        .ParameterFields.GetItemByName("PaymNotes").AddCurrentValue CStr(AdoRSCustSum![PaymNotes])    End If    If Not IsNull(AdoRSCustSum![PaymAmnt]) = True Then        .ParameterFields.GetItemByName("PaymAmnt").AddCurrentValue CStr(AdoRSCustSum![PaymAmnt])    End If    End With    If AdoRSCustSum.EOF = False Then    AdoRSCustSum.MoveNext   ' Move to next record    End IfLoopAdoRSCustSum.CloseSet AdoRSCustSum = Nothing With frmDet    loadMe = True    .CRViewer91.ReportSource = CustSumm    frmDet.CRViewer91.ViewReport    Call WaitTimer(3)    frmDet.CRViewer91.Refresh    frmDet.ShowEnd WithSet CustSumm = NothingSet frmDet = Nothing

Crystal, Select Statement And Passing Fields To CR Parameters
Hi,

I am trying to use parameters in CR to build a report. I have a select join statement and need to show on the report 5 fields that follow the select bit in the sql statement. I have tried a number of things but can't seem to see how to solve this.

On my report inside the VB IDE, I have the 5 fields laid out as parameters. I have no formula fields and when I click Select expert over one of those parameter fields I get just a dialog box with a greyed out OK button.

Heres the code I have so far. Believe it is all wrong because errors show up when the form is trying to show the CRViewer. Any help on this would be breatly appreciated.

Regards,

Davos.
------------------
Set AdoRSCustSum = New ADODB.Recordset
Set frmDet = New CrystRep2Form

strSql = "SELECT C.CustomNber, CB.PaymDate, CB.PaymRef, CB.PaymNotes, " & _
    "CB.PaymAmnt FROM CustomerBilling As CB INNER JOIN Customers As C ON " & _
    "CB.CustID = C.CustID WHERE PaymDate >= #" & FormatDate(Format(dateSlsh1, "mm/dd/yyyy")) & _
    "#" & " AND PaymDate <= #" & FormatDate(Format(dateSlsh2, "mm/dd/yyyy")) & "#"
'debug.print strSql
AdoRSCustSum.Open strSql, myDbCon, adOpenKeyset, adLockOptimistic
Do Until AdoRSCustSum.EOF
    With CustSumm
    .DiscardSavedData
    .EnableParameterPrompting = False
    If Not IsNull(AdoRSCustSum![CustomNber]) = True Then
        .ParameterFields.GetItemByName("CustID").AddCurrentValue CStr(AdoRSCustSum![CustomNber])
    End If
    If Not IsNull(AdoRSCustSum![PaymDate]) = True Then
        .ParameterFields.GetItemByName("PaymDate").AddCurrentValue CStr(AdoRSCustSum![PaymDate])
    End If
    If Not IsNull(AdoRSCustSum![PaymRef]) = True Then
        .ParameterFields.GetItemByName("PaymRef").AddCurrentValue CStr(AdoRSCustSum![PaymRef])
    End If
    If Not IsNull(AdoRSCustSum![PaymNotes]) = True Then
        .ParameterFields.GetItemByName("PaymNotes").AddCurrentValue CStr(AdoRSCustSum![PaymNotes])
    End If
    If Not IsNull(AdoRSCustSum![PaymAmnt]) = True Then
        .ParameterFields.GetItemByName("PaymAmnt").AddCurrentValue CStr(AdoRSCustSum![PaymAmnt])
    End If
    End With
    If AdoRSCustSum.EOF = False Then
    AdoRSCustSum.MoveNext   ' Move to next record
    End If
Loop
AdoRSCustSum.Close
Set AdoRSCustSum = Nothing

With frmDet
    loadMe = True
    .CRViewer91.ReportSource = CustSumm
    frmDet.CRViewer91.ViewReport
    Call WaitTimer(3)
    frmDet.CRViewer91.Refresh
    frmDet.Show
End With
Set CustSumm = Nothing
Set frmDet = Nothing

Crystal, Select Statement And Passing Fields To CR Parameters
Hi,

I am trying to use parameters in CR to build a report. I have a select join statement and need to show on the report 5 fields that follow the select bit in the sql statement. I have tried a number of things but can't seem to see how to solve this.

On my report inside the VB IDE, I have the 5 fields laid out as parameters. I have no formula fields and when I click Select expert over one of those parameter fields I get just a dialog box with a greyed out OK button.

Heres the code I have so far. Believe it is all wrong because errors show up when the form is trying to show the CRViewer. Any help on this would be breatly appreciated.

Regards,

Davos.
------------------
Set AdoRSCustSum = New ADODB.Recordset
Set frmDet = New CrystRep2Form

strSql = "SELECT C.CustomNber, CB.PaymDate, CB.PaymRef, CB.PaymNotes, " & _
    "CB.PaymAmnt FROM CustomerBilling As CB INNER JOIN Customers As C ON " & _
    "CB.CustID = C.CustID WHERE PaymDate >= #" & FormatDate(Format(dateSlsh1, "mm/dd/yyyy")) & _
    "#" & " AND PaymDate <= #" & FormatDate(Format(dateSlsh2, "mm/dd/yyyy")) & "#"
'debug.print strSql
AdoRSCustSum.Open strSql, myDbCon, adOpenKeyset, adLockOptimistic
Do Until AdoRSCustSum.EOF
    With CustSumm
    .DiscardSavedData
    .EnableParameterPrompting = False
    If Not IsNull(AdoRSCustSum![CustomNber]) = True Then
     .ParameterFields.GetItemByName("CustID").AddCurrentValue CStr(AdoRSCustSum![CustomNber])
    End If
    If Not IsNull(AdoRSCustSum![PaymDate]) = True Then
     .ParameterFields.GetItemByName("PaymDate").AddCurrentValue CStr(AdoRSCustSum![PaymDate])
    End If
    If Not IsNull(AdoRSCustSum![PaymRef]) = True Then
     .ParameterFields.GetItemByName("PaymRef").AddCurrentValue CStr(AdoRSCustSum![PaymRef])
    End If
    If Not IsNull(AdoRSCustSum![PaymNotes]) = True Then
     .ParameterFields.GetItemByName("PaymNotes").AddCurrentValue CStr(AdoRSCustSum![PaymNotes])
    End If
    If Not IsNull(AdoRSCustSum![PaymAmnt]) = True Then
     .ParameterFields.GetItemByName("PaymAmnt").AddCurrentValue CStr(AdoRSCustSum![PaymAmnt])
    End If
    End With
    If AdoRSCustSum.EOF = False Then
    AdoRSCustSum.MoveNext ' Move to next record
    End If
Loop
AdoRSCustSum.Close
Set AdoRSCustSum = Nothing

With frmDet
    loadMe = True
    .CRViewer91.ReportSource = CustSumm
    frmDet.CRViewer91.ViewReport
    Call WaitTimer(3)
    frmDet.CRViewer91.Refresh
    frmDet.Show
End With
Set CustSumm = Nothing
Set frmDet = Nothing

Should Be Simple, But Still Eludes Me - Passing Parameters To A Report
I have a report which is based on the following SQL query:


Code:
SELECT Book.ISBN, Book.Title, Book.Author, Book.Format, Book.Price, COUNT(BookOrder.BookISBN) AS BookCount, MAX(Order.DateCreated) AS LastSold, ((Book.Price)*COUNT(BookOrder.BookISBN)) AS TotalIncome
FROM Book, BookOrder INNER JOIN [Order] ON BookOrder.OrderID=Order.OrderID
WHERE Order.DateCreated>[StartDate] And Order.DateCreated<[EndDate] And Book.ISBN=BookOrder.BookISBN
GROUP BY Book.ISBN, Book.Title, Book.Author, Book.Format, Book.Price
ORDER BY COUNT(BookOrder.BookISBN);
As you may be able to see, the two parameters StartDate and EndDate control what is returned. I have a form with a commandbutton under which there is the following code, generated by the control wizard.


Code:
Private Sub BtnPreview_Click()
On Error GoTo Err_BtnPreview_Click

Dim stDocName As String

stDocName = "BestSellers"
DoCmd.OpenReport stDocName, acPreview

Exit_BtnPreview_Click:
Exit Sub

Err_BtnPreview_Click:
MsgBox Err.Description
Resume Exit_BtnPreview_Click

End Sub

Now, when the button is clicked, the report does open, but in doing so two consecutive inputboxes are displayed on the screen asking for the values of StartDate and EndDate. I wish to pass the values of these parameters programmatically so the inputboxes do not appear. I have tried a couple of things with zero success - either having no effect (inputboxes still appear) or causing an error.

I'm sure its one of those things which is super-simple once you know how. If you need any further information about the project dont hesitate to ask.

TIA

Save Report (.rpt) After Passing Parameters To Sql Query
I have the following problem:
I create a rpt file(using CR design windows in VB enviroment) passing the parameter "year" to an ado-command (sql query)with the statement:

Dim Rep as New MyReport
'MyReport is the name of the CR design window
Rep.ParameterField(1).SetCurrentValue year

Then I save the report with the statement:
Report.Save "...Report.rpt"

When I open the file I don't see the data filtered by parameters but I only see the report template.

TIA.

Passing Parameters To Access Report Failed
hi,
there are already samples how to pass parameters to access report and i am using one of them:

acapp.DoCmd.OpenReport "rptDetails", acViewPreview, , INV = "158"

however i am getting errors like 'variable not defined' on 'type mismatch'

so what is the proper syntax/apostrophes to pass a value...

(INV is a text field on my report)

Passing Two Run-time Parameters Into A Data Report
may I know how to pass two parameters from a vb form into the data environment? Does the SQl statement contains two ? marks...to represent the parameters?

Save Report (.rpt) After Passing Parameters To Sql Query
I have the following problem:
I create a rpt file(using CR design windows in VB enviroment) passing the parameter "year" to an ado-command (sql query)with the statement:

Dim Rep as New MyReport
'MyReport is the name of the CR design
'window
Rep.ParameterField(1).SetCurrentValue year

Then I save the report with the statement:
Report.Save "...Report.rpt"

When I open the file I don't see the data filtered by parameters but I only see the report template.

TIA.

Parameters Passing From Visual Basic Form To Crystal Reports
Sir

 Can u suggest me some coding for passing one or more parameters from visual basic form to crystal reports

for example i have designed a application for our library in which there is a for which contains combo box in which lis if all authors is displayed

 as soon as user selects an author and clicks on display
an crystal report

containg
accno/ TITLE/ SUBJECT/PUBLICATION/PRICE
should be displayed
and he should be able to take a print out

now at present i am displaying it in flexgrid
so the user has to notwe down the details of his search

sir can u suggest me some code

i am using coding connection
ie din db as new adodb.connection

so i request u for help

Passing Display Only Parameters To A MSAccess Report - Supressing Warning Message Fro
Hi all,

I'm using the following article as a base for my application
to print preview MSAccess reports from VB6:


HOW TO: Use Automation to Print Microsoft Access Reports in Access 2000
http://support.microsoft.com/?id=210132


Specifically I'm using the Run-Time Version of Microsoft Access.

To be able to pass parameters to Reports I must retrieve the Record Source
for the report
and change the PARAMATERS clause like:

PARAMETERS rptCriteria TEXT = (No Report Criteria);
Select * from tblCompanys;

to

PARAMETERS rptCriteria TEXT = 'Company: Microsoft';
Select * from tblCompanys;

To do this I MUST open the report in DESIGN mode NOT PREVIEW.

And since I'm using the Run-Time Version of Microsoft Access
I get a message on:
objAccess.DoCmd.OpenReport strRptName, acDesign, strFilter, strWhere

'You do not have exclusive access to the database at this time.
If you proceed to make changes you may not be able to save them'



Does anyone know how to suppress this message?

Preferably with a commandline argument like /silent when I shell to the
Run-Time Version of Microsoft Access.

Passing Display Only Parameters To A MSAccess Report - Supressing Warning Message From Run
Hi all,
    I'm using the following article as a base for my application
    to print preview reports:


HOW TO: Use Automation to Print Microsoft Access Reports in Access 2000
http://support.microsoft.com/?id=210132


Specifically I'm using the Run-Time Version of Microsoft Access.

To be able to pass parameters to Reports I must retrieve the Record Source
for the report
and change the PARAMATERS clause like:

    PARAMETERS rptCriteria TEXT = (No Report Criteria);
    Select * from tblCompanys;

to

    PARAMETERS rptCriteria TEXT = 'Company: Microsoft';
    Select * from tblCompanys;

To do this I MUST open the report in DESIGN mode NOT PREVIEW.

And since I'm using the Run-Time Version of Microsoft Access
I get a message on:
        objAccess.DoCmd.OpenReport strRptName, acDesign, strFilter, strWhere

'You do not have exclusive access to the database at this time.
If you proceed to make changes you may not be able to save them'



Does anyone know how to suppress this message?

Preferably with a commandline argument like /silent when I shell to the
Run-Time Version of Microsoft Access.









 

How Can I Access My Report (crystal Report) In Vb? What Parameters Do I Have To Set?
how can i access my report (crystal report) in vb? what parameters do i have to set in order to "load" my crystal report.

Parameters In Crystal Report
hi,

i want to print a report on the basis of what user enters in a text field. i have written the sql statement in crystal report but i dont know how to declarea variable in CR. and how to tranfer the value of text box to that variable... so that when i call the printreport, the sql statement executes with that value..
please help.....

thanx..

Crystal Report 7 (Parameters)
I have a crystal report that I am editing. It's run though a website which then creates a PDF file with the results. The problem i'm having is I need to create a parameter from one of criteria selected while setup up the report on the website. I don't have access to any of the code the website uses when it runs the report so I can't modify it to pass in any parameters. It might already pass this value to the report, but I have no idea how to setup a parameter to access this value, or even know that it exists or it's called.

I'm using Crystal Reports 7 and i'm pretty much a newbie with CR.

Any help appreciated. Thanks.

(BTW the system we are using is Kronos)

Crystal Report Parameters
I am trying to open up a crystal report threw vb and as part of that i am trying to pass in 2 date parameters.
The report appears but there is no data available, but when i run the report within the crystal reports app, i do get data back.

My code is this :

Private Sub cmdGo_Click()
Dim stParam As String

fra1.Visible = False
frmViewer.Height = 10000
frmViewer.Width = 15140
frmViewer.Top = 650
frmViewer.Left = 100
If optType(1).Value = True Then
DateFrom = cboFrom.Value
DateTo = cboTo.Value
End If

Dim CRXApplication As New CRAXDRT.Application
Dim CRXReport As CRAXDRT.Report
Dim CRXDatabase As CRAXDRT.Database

Set CRXReport = CRXApplication.OpenReport(APPConst.DatabasePath & stReport & ".rpt")
Set CRXDatabase = CRXReport.Database
SQL$ = "Select * From " & stTable
SQLRecs.Open SQL$, cn, adOpenStatic
CRXReport.DiscardSavedData
CRXDatabase.SetDataSource SQLRecs, 3, 1

Dim crpParamDefs As CRAXDRT.ParameterFieldDefinitions
Dim crpParamDef As CRAXDRT.ParameterFieldDefinition
CRXReport.EnableParameterPrompting = False
Set crpParamDefs = CRXReport.ParameterFields
For Each crpParamDef In crpParamDefs
With crpParamDef
Select Case .ParameterFieldName
Case "DateFrom"
.ClearCurrentValueAndRange
.SetCurrentValue DateFrom
Case "DateTo"
.ClearCurrentValueAndRange
.SetCurrentValue DateTo
End Select
End With
Next
SQLRecs.Close

crViewer.ReportSource = CRXReport
crViewer.Height = 9400
crViewer.Width = 14900
crViewer.Top = 50
crViewer.Left = 50
crViewer.ViewReport

I have tried passing the dates in with some formatting but still with no luck.
Can anyone advise.

Thanks

Ian.

Sub Report Parameters Crystal 8.5 In VB
Here is my code

Private Sub Form_Load()
Me.WindowState = vbMaximized
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
Dim crpParamDef As CRAXDRT.ParameterFieldDefinition

For Each crpParamDef In Report.ParameterFields
Select Case crpParamDef.Name
Case "{?Location}"
crpParamDef.AddCurrentValue (CLng(frmStartAveTurnaroundTime.txtLocation.Text))
Case "{?Master Company}"
crpParamDef.AddCurrentValue (CLng(frmStartAveTurnaroundTime.txtCoID.Text))
Case "{?Date From:}"
crpParamDef.AddCurrentValue CDate(frmStartAveTurnaroundTime.txtStartDate.Text)
Case "{?Date To}"
crpParamDef.AddCurrentValue CDate(frmStartAveTurnaroundTime.txtEndDate.Text)
Case "{?Local company}"
crpParamDef.AddCurrentValue (CLng(frmStartAveTurnaroundTime.txtCoID.Text))
Case "{?Appraiser}"
crpParamDef.AddCurrentValue (CLng(frmStartAveTurnaroundTime.txtAppID2.Text))
Case "{?Assignment Type}"
crpParamDef.AddCurrentValue (frmStartAveTurnaroundTime.DataCombo3.Text)
End Select
Next
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
Set Report = Nothing
End Sub
--------------------
I need to somehow also pass 3 parmeters to the sub report from my VB viewer form. I can't seem to get the info from the Crystal help file.

Thanks for any and all help--this is driving me nuts

Crystal Report Parameters
Hi
I need help - preferably in code form as how I can pass the parameters to a Crystal Report Query (below) from text boxes in a form.
SELECT * FROM $ACCOUNT_TREELIST$$(1,0,NULL,(?param1), (?param))

Both paramaters are numbers.

Any help would be appreciated.
Thank
Cathal

Crystal Report Parameters
Hi,

I have a problem with the parameters passing.

Suppose you have a report that contains three sub reports. These sub reorts are linked to the main report columns. But the main report requires two string parameters to be passed.

How can I pass parameter values to the report. Currently I am using the Report.ReplaceSelectionFormula property to do but it is not the correct way to do things :-)

So Can you guide me on how to do it ?

Thanks,
Krogoth!


FSM

Crystal Report Parameters
Hi
I hope someone can help me with this problem. I've created a Crystal Report within the Crystal Report Software environment. I placed a parameter field called WorkOrder on my report to filter the report by work order. Now I want to call the report from VB, I placed a crystal viewer on my form and a text box to enter the Work order number. Here is the code that I have so far under a command button. When I click the button, I get the error number 9. "Subscript out of range". What am I doing wrong? Do I have the wrong parameter number? If so how can I find out the index of the parameter?
I've been working on this for 2 days now and I just can't see what is wrong
Thanks for any help.

Dim rdApp As CRAXDRT.Application
Dim rpt As CRAXDRT.Report

Set rdApp = CreateObject("Crystalruntime.application")
Set rpt = rdApp.OpenReport("c:VB Call Log 2 improvementsCallLog.rpt")
rpt.ParameterFields(0) = "WorkOrder;" & frmMain.Text1.Text & ";True"
CRViewer1.ReportSource = rpt
CRViewer1.ViewReport

Crystal Report Parameters
Hi
I have created a report within the Crystal Report software and I have placed a parameter field called WorkOrder on the report so that I can filter based on work order number. I want to open this report within VB, I have placed a crystal report viewer, a text box for users to enter a work order number and under a command I have this code

Dim rdApp As CRAXDRT.Application
Dim rpt As CRAXDRT.Report

Set rdApp = CreateObject("Crystalruntime.application")
Set rpt = rdApp.OpenReport("c:VB Call Log 2 improvementsCallLog.rpt")
rpt.ParameterFields(0) = "WorkOrder;" & frmMain.Text1.Text & ";True"
CRViewer1.ReportSource = rpt
CRViewer1.ViewReport

When I click this button, I get Error number 9 "Subscript out of range", reading the help files it would seem that the parameter index might be wrong. If it is wrong, how can I find out the index of it? Or is it something in my code? I have no clue, I've been working on this for 2 days. Can anyone help?

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