| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Passing a VB string to a Crystal parameter field
Hello,
I'm having trouble passing a VB string to a Crystal Report parameter field. Following is an excerpt of the code: -------------------------------------------------- strDocID = InputBox("Please enter the DocID") If strDocID <> "" Then With CrystalReport1 .ReportFileName = "C:\Program Files\CSC Imaging\CSCReports\Reports\DocumentHistory.rpt" .Connect = cn.ConnectionString .WindowState = crptMaximized strSelection = "{CSC_TRANS.Document_ID} = " & "'" + strDocID + "'" .ReplaceSelectionFormula strSelection .Destination = crptToWindow .Action = 1 --------------------------------------------------- The user enters the DocID, but when the Crystal Report launches, the user has to enter it again. Following is the entry in the Record Selection Formula: {CSC_TRANS.Document_ID} = {?DocumentID_PROMPT} Also, if they select Cancel in the Crystal parameter window, it still tries to run the report. How can I stop the report from running? Thank you for your assistance! Andy |
|
#2
|
|||
|
|||
|
either is wrong the formula,and is crystal report,doesn't know the field. or...
work with an report object,and put Public reportApp As CRAXDRT.Application Public Report As CRAXDRT.Report reportApp=createobject("CRAXDRT.Application") report=reportApp.loadReport("....rpt") ...for not showing parameter prompting Report.EnableParameterPrompting=false report is an object of craxdrt.dll i thing at least i have worked with this one.this is for not showing the parameters inputs again. also,it should be existing in the report(in design) a parameter(Insert/Parameter) and the value for that should have your docID value something like this. Dim cpars As CRAXDRT.ParameterFieldDefinitions Dim cpar As CRAXDRT.ParameterFieldDefinition Set cpar = cpars(1) cpar.AddCurrentValue (docID) docID here is your VB variable Maybe this will work,or try to verify carefully the selection formula,AND in report it should be existing a parameter that will take in the code that value! Good luck |
|
#3
|
|||
|
|||
|
Thank you very much for the reply, jasie24!
|
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|