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!

Displaying Parameters using a RS 1

Status
Not open for further replies.

Wacki

Programmer
Oct 28, 2004
35
US
I am using cr v10. I have created a report that has 8 parameter fields that are passed in using a VB 6.0 front end. The problem is that the report is not displaying any of the paramerter fields. It does display a message that states "Field name is unknown". It took some time to discover that it didn't know what the parameter fields were. Can anyone tell me how to get the parameters to display on the report when I am using a recordset for the database.SetDataSource setting.

TIA
 
How about some more information:
- Parameter data types
- Range, Discrete, Multiple Value
- Expected output on the report
- How you're passing the parameters

-dave
 
Parameter data types = adVarChar
Passing in from the following code.

With .Parameters(2)
If frmMainMenu.cboPortfolio.Text = "Portfolio" Then
.Value = ""
Else
.Value = frmMainMenu.cboPortfolio.Text
End If
.Direction = adParamInput
.Type = adVarChar
End With

The values are 3 characters in length (i.e. "ABC", "CBS", "FOX")

expected output would be same as passed in.


Let me know if you need more information.

Thanks
 
Ok, so you're setting what looks to be stored proc parameters to create the recordset, as opposed to having parameter fields built into the report.

Create a formula field in the report, call it
'ReportParams', give it text of "", drag it onto the report, and adjust the width in order to fit the max. number of parameters.

In VB, when you're setting your parameters, put them together in a string however you want them to display on the report. For example, if you want them in a comma separated list:
[tt]
Dim strParams As String
strParams = ""


With .Parameters(2)
If frmMainMenu.cboPortfolio.Text = "Portfolio" Then
.Value = ""
Else
.Value = frmMainMenu.cboPortfolio.Text
strParams = strParams & frmMainMenu.cboPortfolio.Text & ", "
End If
.Direction = adParamInput
.Type = adVarChar
End With
'Set the rest of your parameters similarly
'Then send the parameter list to the report

If strParams <> "" Then
strParams = Mid(strParams, 1, Len(strParams) - 2)
End If
crxRpt.FormulaFields.GetItemByName("ReportParams").Text = "'" & strParams & "'"
[/tt]
-dave
 
I don't think you have the jist of what the problem is. I can pass the parameters to the stored procedure, but I can't get the report to display them. It will display the data returned from the procedure, but will not dispaly the parameters. I have tried what you are suggesting, but to no avail. I still get nothing from any of the parameters. What I do get is the error message stated above.

I am populating the report from a recordset in the VB app. I think this is why I can't get the parameters to display. It displays the data from the recordset, but nothing else.
 
With crViewer2
With crDemandPlan
With datcmd1
.CommandText = "usp_DemandAndRevenuePlanning"
.CommandType = adCmdStoredProc
.CommandTimeout = 300
.Parameters.Refresh

--Add parameters here--

End With
.EnableParameterPrompting = False
.Database.SetDataSource rs
End With
End with

This might be of some help.
 
Dave,

Thanks For all the help. I have to admit I fat fingered the quoted name on the field, and since I fixed that problem it seems to be working fine. Thanks for all the patience.

Wacki
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top