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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying Parameter Values in a Message Box or String 1

Status
Not open for further replies.

crimsntyd

Programmer
Sep 27, 2005
55
0
0
US
Hi,
I have a viewer in VB that works really well, and even gives the user a message when there are no records for the parameters they've entered (I'm using Crystal to handling parameter input, not passing them through VB). What I'd like to do is show the parameters they selected in the message box that appears (or some other way). But, I don't know how to retrieve the parameters in VB. Any ideas? Thanks in advance.

VB 6.0
Windows 2000
Crystal Reports XI
 
That can get tricky if you're dealing with multiple value or range parameters, but if you're just dealing with single values, you can use the 'hidden' CurrentValue property of the ParameterFieldDefinition. This code would should be placed after forcing a ReadRecords, or immeidately after sending the report to a Viewer:
Code:
Dim strMsg As String
Dim i As Integer

For i = 1 To rpt.ParameterFields.Count
    With rpt.ParameterFields(i)
        strMsg = strMsg & .ParameterFieldName & " value: " & .CurrentValue & vbCrLf
    End With
Next i

MsgBox strMsg
-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top