Solved

How to prevent displaying prompt for parameters in Crystal reports?

Posted on 2002-04-04
7
473 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
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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 200 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 100

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

777 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