CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual Basic Programming > Crystal Reports
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old March 12th, 2004, 04:23 PM
    Andy99 Andy99 is offline
    Junior Member
     
    Join Date: Apr 2003
    Posts: 7
    Andy99 is an unknown quantity at this point (<10)
    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
    Reply With Quote
      #2    
    Old March 15th, 2004, 05:45 AM
    jasie24 jasie24 is offline
    Member
     
    Join Date: Jan 2003
    Posts: 162
    jasie24 is an unknown quantity at this point (<10)
    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
    Reply With Quote
      #3    
    Old March 16th, 2004, 07:46 PM
    Andy99 Andy99 is offline
    Junior Member
     
    Join Date: Apr 2003
    Posts: 7
    Andy99 is an unknown quantity at this point (<10)
    Thank you very much for the reply, jasie24!
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual Basic Programming > Crystal Reports


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 09:37 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009