Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to prevent displaying prompt for parameters in Crystal reports?

Posted on 2002-04-04
7
Medium Priority
?
483 Views
Last Modified: 2012-06-22
I create a file using Crystal Reports ActiveX control.
I pass parameters to report (see the code below) but user always is prompted by Crystal Reports to confirm parameters even the code passes them directly. What should I do to prevent displaying the parameter dialog box? I tried TRUE and FALSE, but prompt appears in both cases.
With crtReport
    .Reset
    .Connect = mstrRepCnn
    .ReportFileName = mstrDirName & "\" & mstrRepFRE
    .SelectionFormula = "{FRETemp.FRE} = '" & _
            lvwAccountAll.ListItems(i) & "' AND " & _
            "{FRETemp.BalanceDate} = #" & _
            lvwAccountAll.ListItems(i).SubItems(3) & "#"
    .ParameterFields(0) = "OldBalDate;" & _
            Format(lvwAccountAll.ListItems(i).SubItems(6), _
            "dd mmm, yyyy") & ";FALSE"
    .ParameterFields(1) = "NewBalDate;" & _
            Format(lvwAccountAll.ListItems(i).SubItems(3), _
            "dd mmm, yyyy") & ";FALSE"
    .Destination = crptToFile
    .PrintFileType = crptText
    .PrintFileName = "C:\" & Format$(gdatDate, "mmm-dd-yyyy") & "_" & _
            lvwAccountAll.ListItems(i) & ".txt"
    .DiscardSavedData = True
    .ProgressDialog = False

    .Action = 1                    ' This method generates the error number in case of error '
End With
0
Comment
Question by:timofeia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 

Expert Comment

by:nkunapaneni
ID: 6918358
Make sure that ParameterFields name "NewBalDate" matches with the Parameter in the report and make

   ParameterFields(1) = "NewBalDate;" & _
           Format(lvwAccountAll.ListItems(i).SubItems(3), _
           "dd mmm, yyyy") & ";True"
     
And check if there are any parameters left out in the reports that need the values.
0
 

Author Comment

by:timofeia
ID: 6918373
nkunapaneni, I tried it already. If I use True it displays the empty fields for parameters, if I use False it displays parameter dialog box with parameters already assigned. But in both cases parameter dialog box is displayed.
0
 

Expert Comment

by:nkunapaneni
ID: 6918440
Hi
If u use True = it will not display the dialogbox and will assign the value to the parameter

ANd false  - will not display the dialogbox and will not assign the vlaue to the parameter

For example
in my Report i have a Parameter "RptCriteria"  which is defined as string, and default values none. ANd i placed that parameter in the report header.

In my vb code i use
sRptCriteria  = "This is Parameter Value"
.ParameterFields(0) = "RptCriteria;" & sRptCriteria & ";True"

This will assign the Parameter the value properly with out displaying the dialog.

I hope this helps.


       
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:timofeia
ID: 6918454
nkunapaneni, I tested it a minute ago. It still displays parameter dialog box with empty fields for parameters. I do not know what is wrong. Parameter names are right, and I have 2 parameters only.
0
 
LVL 18

Accepted Solution

by:
mdougan earned 800 total points
ID: 6918634
Well, one option is to go back into Crystal and remove the parameters and instead use Formula fields.  You can reference a Formula Field in Crystal anywhere that you can reference a parameter field, I believe.  So, if you then set your crystal report formulas:

With crtReport
   .Reset
   .Connect = mstrRepCnn
   .ReportFileName = mstrDirName & "\" & mstrRepFRE
   .SelectionFormula = "{FRETemp.FRE} = '" & _
           lvwAccountAll.ListItems(i) & "' AND " & _
           "{FRETemp.BalanceDate} = #" & _
           lvwAccountAll.ListItems(i).SubItems(3) & "#"
   .Formulas(0) = "OldBalDate=" & _
           Format(lvwAccountAll.ListItems(i).SubItems(6), _
           "dd mmm, yyyy")
   .Formulas(1) = "NewBalDate=" & _
           Format(lvwAccountAll.ListItems(i).SubItems(3), _
           "dd mmm, yyyy")
   .Destination = crptToFile
   .PrintFileType = crptText
   .PrintFileName = "C:\" & Format$(gdatDate, "mmm-dd-yyyy") & "_" & _
           lvwAccountAll.ListItems(i) & ".txt"
   .DiscardSavedData = True
   .ProgressDialog = False

   .Action = 1                    ' This method generates the error number in case of error '
End With
 
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 6919830
Dates must be passed in a very specific format.  Date (yyyy,mm,dd)

Change

   .ParameterFields(0) = "OldBalDate;" & _
           Format(lvwAccountAll.ListItems(i).SubItems(6), _
           "dd mmm, yyyy") & ";FALSE"
   .ParameterFields(1) = "NewBalDate;" & _
           Format(lvwAccountAll.ListItems(i).SubItems(3), _
           "dd mmm, yyyy") & ";FALSE"

to


   .ParameterFields(0) = "OldBalDate;" & _
           Format(lvwAccountAll.ListItems(i).SubItems(6), _
           "yyyy,mm,dd") & ";TRUE"
   .ParameterFields(1) = "NewBalDate;" & _
           Format(lvwAccountAll.ListItems(i).SubItems(3), _
           "yyyy,mm,dd") & ";TRUE"

mlmcc
0
 

Author Comment

by:timofeia
ID: 6921102
mdougan solution works perfectly, thanx
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question