Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can Someone tell me what I'm doing wrong with Crystal Report 4.6?

Status
Not open for further replies.

ICTECH

Technical User
Jun 5, 2002
131
CA
Hi All..

I'm trying to pass a date parameter to my Report and I'm getting a blank report.. HELP... Did I miss anything or have I entered something wrong... Thanks for the help...
Here is the code from my VB App..

<CODE START>

Dim Test As String
Test = &quot;6/24/2002&quot;

CrystalReport1.ReportFileName = App.Path & &quot;\Test.rpt&quot;
CrystalReport1.DiscardSavedData = True
CrystalReport1.SelectionFormula {test.Date}= &quot; #&quot; & test & &quot;# &quot;
CrystalReport1.Destination = crptToWindow
CrystalReport1.WindowState = crptMaximized
CrystalReport1.Action = 1

<Code END>
 
Try this:

CrystalReport1.SelectionFormula = '{test.Date}= &quot; #&quot; & test & &quot;# &quot; '
 
Correction. Try this:
CrystalReport1.SelectionFormula =
'{test.Date}= Date(yyyy,mm,dd)'
where &quot;yyyy&quot;, &quot;mm&quot; and &quot;dd&quot; are numeric values for the year, month, and day you want to pass. Version 4.6 does not have the variety of date conversion formats that are provided in later versions of CR. Note that the entire expression is enclosed in quotes because the OCX property &quot;SelectionFormula&quot; is a string value.


 
Hi Rogar...

I just tried it out and I still get a blank report.. Maybe I'm missing something in my report. Was reading in the help file about having to decliring variables before you use them in the report formulas, but it doesn't say how or were to decleait them. Got to love things that make you go hmmm..

 
You're not using any CR Variables in your selection formula. {test.Date} is a database field and
&quot;Date(yyyy,mm,dd)&quot; is a CR formula.

Are you sure there is data in the database for the date you are using? Can you run the report in the CR report designer? You may have to edit in the selection formula which is passed from your app to run the rpt stand-alone.
If your CR designer is not Version 4.6, be sure to keep a backup copy of the .rpt file.
 
Hi Rogar...

It is version 4.6 and yes there is data for the date I'm trying to use. If I go into the Edit Selection Formula \Record under Report, I have a blank formula text.. Should there be anything in there to make this work? I want to display only the data for the date passed to the report...

I found a scetchy info about using &quot;RecordSelection&quot; But when I try in, there VB doesn't know what it is.. Is this something thats in a newer version than 4.6?

Thanks for the help..
 
date format for passing parameters is
test = 2002,07,01
&quot;{test.date}>=date(&quot;& test & &quot;)
 
Hi shrisaianandhi...

Will try this.. Thanks...

 
Hi All...

I've run into a new one..

My report works. How would you pass to the report to SelectionFormula criteria?

When I try to use two SelectFormula commands I ony get the last one working..

I'm trying to pick a specific date and driver to be displayed.

Any ideas?
 
You can only pass one formula, so pass both conditions, with an 'and' between them, as one formula. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Hi Ken...

How's it going.

I've run into an interesting problem. Is Crystal Report 4.6 able to handle multiple Selection criteria?

My report works great, thanks. I can pass it a Date and it displays the information in the database. If I pass it a date and a particular Client Name it ovrrides the Date and shows me everything in the database to do with that client.

Any ideas on how I can pass the two selection criterias?

Thanks for the help..

 
Open the report in the report designer and put in specific criteria for a date and a client using the selection expert. Now click &quot;show formula&quot; and see how Crystal wrote that formula. You can even run the report and make sure that it gets the records correctly.

What you have to do is pass a string that gets to crytal in the exact same syntax as the formula built by the CR expert. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
With CR4.6 I suspect you are using the OCX (Crystl32.OCX) for VB/CR integration.
There are two record selection formula methods...

crObj.SelectionFormula = &quot;....&quot; appends to the existing report some additional criteria.

crObj.ReplaceSelectionFormula &quot;...&quot; replaces the entire selection formula.

Be careful you are not creating mutually exclusive criteria with the first method...
{CustID}=&quot;1&quot; and {CustID}=&quot;2&quot; //will return no records and no customer can have two numbers Editor and Publisher of Crystal Clear
 
Hi Ken...

Thanks.

It took me a few tries to get the VB format right to pass both selection criterias.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top