Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Missing Parameter Error

Status
Not open for further replies.

frankienstien

Programmer
Apr 12, 2006
8
US
I am trying to get crystal XI to print a selected report when the user clicks on the report.
but everytime i do that i receive the error missing parameter.
i have two parameters that are used in the data selection expert
Code:
{@TransactionDate} in {?StartDate} to {?EndDate}
i have just turned off the save data "feature" in the hope that when i told this to print it would ask the user for the date ranges to enter and then print the report. the report did work until then but would always print with the saved info from the last view.
i could also use the default value field in the paramter but i don't know what the command is for the current date.
everytime i enter something in that box it is removed after i leave.
Code:
Private Sub PrintButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintButton.Click
        Me.Cursor = Cursors.WaitCursor
        Dim rdReport As New ReportDocument
        rdReport.Load("C:\Cash\Reports\New\" & ReportListBox.GetItemText(ReportListBox.SelectedItem) & ".rpt")

        rdReport.PrintToPrinter(1, True, 0, 0)
        Me.Cursor = Cursors.Default
    End Sub
 
Within Crystal if you have the subreport LINKed via the date parameters in the main report, I would think that it should work.

-k
 
sorry i didn't explain very well.
there is no subreport. it is just a simple report that needs to know the starting date and ending date to retrieve information from the database.
if i use the report viewer i will get the prompts to enter the info.
if i try to print the report directly to the printer without opening it in the viewer is when i receive the problem.
thanx
 
thanx for your help.
this is what i discovered.
Code:
Dim rdReport As New ReportDocument
rdReport.Load("C:\Cash\Reports\New\" & reportListBox.GetItemText(ReportListBox.SelectedItem) & ".rpt")
rdReport.SetParameterValue("StartDate", Now.Date)
rdReport.SetParameterValue("EndDate", Now.Date)
rdReport.PrintToPrinter(1, True, 0, 0)
            Me.Cursor = Cursors.Default
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top