Solved

How to prevent displaying prompt for parameters in Crystal reports?

Posted on 2002-04-04
7
467 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now