468,513 Members | 1,766 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

Cannot suppress parameter prompts at runtime (Crystal Report)

Report source is an SQLSERVER 2K store procedure. VB.NET application. Report
created by CR 8.5.
At runtime, I still had to click "CANCEL" to bypass the parameter prompts
before the report display correctly. Also, print option grayed out although
it was available at design time.
Thanks a million!
Bill

---------------

Below is the code:

crRptName = crRptPath & Trim(rptName)

Try

reportDocument1.Load(crRptName)
Dim ParameterFields As CrystalDecisions.Shared.ParameterFields

Dim ParameterField0 As CrystalDecisions.Shared.ParameterField

Dim ParameterField1 As CrystalDecisions.Shared.ParameterField

Dim ParameterDiscreteValue0 As
CrystalDecisions.Shared.ParameterDiscreteValue

Dim ParameterDiscreteValue1 As
CrystalDecisions.Shared.ParameterDiscreteValue

ParameterFields = New CrystalDecisions.Shared.ParameterFields

ParameterField0 = New CrystalDecisions.Shared.ParameterField

ParameterField0.ParameterFieldName = "@salesdate"

ParameterField1 = New CrystalDecisions.Shared.ParameterField

ParameterField1.ParameterFieldName = "@inflag"

ParameterDiscreteValue0 = New CrystalDecisions.Shared.ParameterDiscreteValue

ParameterDiscreteValue0.Value = rptParam0

ParameterDiscreteValue1 = New CrystalDecisions.Shared.ParameterDiscreteValue

ParameterDiscreteValue1.Value = rptParam1

ParameterField0.CurrentValues.Add(ParameterDiscret eValue0)

ParameterField1.CurrentValues.Add(ParameterDiscret eValue1)

ParameterFields.Add(ParameterField0)

ParameterFields.Add(ParameterField1)

lblPrintWait.Text = "Loading report. Please wait..."

lblPrintWait.Visible = True

Me.Cursor = Cursors.WaitCursor

With myCrystal.CrystalReportViewer1

..ReportSource() = reportDocument1

..SelectionFormula = mSelection

If rptParam0 <> "NA" Then

..ParameterFieldInfo = ParameterFields

End If

'.ShowExportButton = True

'.ShowPageNavigateButtons = True

..ShowPrintButton = True

'.PrintReport()

..RefreshReport()

End With

Me.Cursor = Cursors.Default

lblPrintWait.Visible = False

myCrystal.WindowState = FormWindowState.Maximized

myCrystal.ShowDialog()

Catch ex As Exception

MsgBox(ex.Source & ": " & ex.Message)

End Try

Nov 20 '05 #1
1 6127
This won't solve your problems, but...

I've got the same problem. Today I discovered that "enter parameter
values" dialog is only shown if the form (or crystal viewer) is not
visible.
This is crazy! I've been trying to find a workarround. The problem is
(in my case) that the dialog is displayed even if the form's visible
property is set to true and location is in invisible area.

I hope we find a workarround.

Regards,
Jernej

"Bill Nguyen" <bi*****************@jaco.com> wrote in message news:<OE**************@TK2MSFTNGP12.phx.gbl>...
Report source is an SQLSERVER 2K store procedure. VB.NET application. Report
created by CR 8.5.
At runtime, I still had to click "CANCEL" to bypass the parameter prompts
before the report display correctly. Also, print option grayed out although
it was available at design time.
Thanks a million!
Bill

---------------

Below is the code:

crRptName = crRptPath & Trim(rptName)

Try

reportDocument1.Load(crRptName)
Dim ParameterFields As CrystalDecisions.Shared.ParameterFields

Dim ParameterField0 As CrystalDecisions.Shared.ParameterField

Dim ParameterField1 As CrystalDecisions.Shared.ParameterField

Dim ParameterDiscreteValue0 As
CrystalDecisions.Shared.ParameterDiscreteValue

Dim ParameterDiscreteValue1 As
CrystalDecisions.Shared.ParameterDiscreteValue

ParameterFields = New CrystalDecisions.Shared.ParameterFields

ParameterField0 = New CrystalDecisions.Shared.ParameterField

ParameterField0.ParameterFieldName = "@salesdate"

ParameterField1 = New CrystalDecisions.Shared.ParameterField

ParameterField1.ParameterFieldName = "@inflag"

ParameterDiscreteValue0 = New CrystalDecisions.Shared.ParameterDiscreteValue

ParameterDiscreteValue0.Value = rptParam0

ParameterDiscreteValue1 = New CrystalDecisions.Shared.ParameterDiscreteValue

ParameterDiscreteValue1.Value = rptParam1

ParameterField0.CurrentValues.Add(ParameterDiscret eValue0)

ParameterField1.CurrentValues.Add(ParameterDiscret eValue1)

ParameterFields.Add(ParameterField0)

ParameterFields.Add(ParameterField1)

lblPrintWait.Text = "Loading report. Please wait..."

lblPrintWait.Visible = True

Me.Cursor = Cursors.WaitCursor

With myCrystal.CrystalReportViewer1

.ReportSource() = reportDocument1

.SelectionFormula = mSelection

If rptParam0 <> "NA" Then

.ParameterFieldInfo = ParameterFields

End If

'.ShowExportButton = True

'.ShowPageNavigateButtons = True

.ShowPrintButton = True

'.PrintReport()

.RefreshReport()

End With

Me.Cursor = Cursors.Default

lblPrintWait.Visible = False

myCrystal.WindowState = FormWindowState.Maximized

myCrystal.ShowDialog()

Catch ex As Exception

MsgBox(ex.Source & ": " & ex.Message)

End Try

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Vetril Group | last post: by
1 post views Thread by Mike Pettet | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.