
Passing Text to Crystal Report
Yes, there are more than one ways to pass a string:
1- You can define a parameter which data type is string. Then set this
parameter value from your VB code.I use this method and it works good. Here
is a sample code :
Dim value As PEValueInfo
Dim paramInfo As PEParameterFieldInfo
Dim UserNameStr as String
paramInfo.StructSize = Len(paramInfo)
value.StructSize = Len(value)
UserNameStr="JOE"
value.valueType = PE_PF_STRING
value.viString = UserNameStr & Chr$(0)
If PEConvertVInfoToPFInfo(value, value.valueType, paramInfo.CurrentValue)
= 0 Then
MsgBox Str$(PEGetErrorCode(printJob))
End If
If PESetNthParameterField(printJob, i, paramInfo) = 0 Then
MsgBox Str$(PEGetErrorCode(printJob))
End If
PS. This code uses Print Engine Calls in order to run a Crystal Report File