Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 23rd, 2009, 04:36 AM
Registered User
 
Join Date: Dec 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing Parameters to Crystal Reports 8.5 using VB6

I used parameter fields in my crystal report and was able to pass parameters to it from my Visual Basic program. But the problem is the dialog box that keeps appearing asking me to enter the parameters. The discrete values have the same values as the parameters being passed. I do not want to enter the values again. How do I remove the dialog box?

My code:

Code:
Dim CRApp As New CRAXDRT.Application
Dim CRReport As New CRAXDRT.Report   'crystal report object
Dim CrtParameters As CRAXDRT.ParameterFieldDefinitions
Dim sRPTFile As String
Dim simula As String
Dim tapos As String
sRPTFile = App.Path & "\01653.rpt"
Set CRReport = CRApp.OpenReport(sRPTFile)

    simula = Format(DTPicker1.Value, "YYYY/MM/DD")
    tapos = Format(DTPicker2.Value, "YYYY/MM/DD")
    
    With CRReport
        .DiscardSavedData
        .Database.Tables.Item(1).SetLogOnInfo odbcname, odbcname,sysuserid, syspassword
        Set CrtParameters = CRReport.ParameterFields
        .ParameterFields.GetItemByName("@begdate").AddDefaultValue simula
        .ParameterFields.GetItemByName("@enddate").AddDefaultValue tapos
    End With

    'Show Report
    CRViewer1.ReportSource = CRReport
    CRViewer1.EnableExportButton = True
    CRViewer1.DisplayGroupTree = False
    CRViewer1.EnableDrillDown = True
    CRViewer1.EnableDrillDown = False
    CRViewer1.EnableCloseButton = True
    CRViewer1.ViewReport
    CRViewer1.Zoom (100)
    CRViewer1.Visible = True
    CRViewer1.ZOrder 0
Thanks in advance for helping.
 
Old December 28th, 2009, 10:04 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hello..

If CR is asking for parameters, Then you are not passing them correctly, you have more parameters that you think, the query to the database from the report is wrong or some formulas are empty and are expecting a value...
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameters to crystal reports at runtime tbhakee Crystal Reports 14 September 11th, 2013 05:49 AM
passing parameters to crystal reports Shubhi ASP.NET 2.0 Professional 0 July 4th, 2008 02:18 AM
Passing parameters w/o prompt to Crystal Reports VannAustin BOOK: Professional Crystal Reports for VS.NET 1 August 31st, 2006 08:46 AM
Passing Parameters to crystal reports through codi secrets Crystal Reports 0 April 5th, 2005 01:44 PM
Passing parameters w/o prompt to Crystal reports VannAustin VB How-To 0 March 2nd, 2005 02:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.