I am trying to use this particular API and it was working fine until I re-installed Crystal Reports 8.0 and it now crashes. Once it reaches the
Code:
 End Sub
it shuts the whole program down.

Here is the API and the code:

Code:
'Added the calls for Sending SQL Server Parameters.
Declare Function PEAddParameterCurrentValue Lib "crpe32.dll" (ByVal printJob%, ByVal parameterFieldName$, ByVal reportName$, currentValue As PEValueInfo) As Integer
Code:
Private Const iSTRUCT_SIZE_PARAM = 316
Code:
Public Sub SetParameters()
Dim vParam As Variant
Dim objValue As PEValueInfo
Dim lngHandle As Long
Dim strErrDesc As String
Dim x As Integer
For Each vParam In mcolParam
    With objValue
    'Set the structure size for the PEValueInfo
        .StructSize = iSTRUCT_SIZE_PARAM
    'Set the Datatype = 4 (Integer).
        .valueType = 4
    'Assign the value you are passing into the parameter
    'SQL statement.
        .viString = vParam.sValue
    End With
    'Set the value that is being passed in.
    'miPrintJob = Print job number (Integer)
    'vParam.sName = Parameter variable being used (ex. @Where, @Where2, etc.)
    'objValue = The PEValueInfo that was set previously.
    mbSuccess = PEAddParameterCurrentValue(miPrintJob, vParam.sName, "", objValue)
    If mbSuccess = False Then
        MsgBox "Error Code: " & PEGetErrorCode(miPrintJob) & " Occured in Set Parameters Function.", vbCritical, "Orcas Error Message"
        x = PEGetErrorText(miPrintJob, lngHandle, 50)
        x = PEGetHandleString(lngHandle, strErrDesc, 100)
    End If
Next

End Sub
ThAnKs