?
Solved

How to prevent displaying prompt for parameters in Crystal reports?

Posted on 2002-04-04
7
Medium Priority
?
484 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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
Course of the Month14 days, 14 hours left to enroll

840 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