Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Selection Formula Problem Crystal Reports


Hi there

I want to pass a parameter from vb6 that whould return like in this example cust 1 and cust 2. How do I do this? Because the selection formula does not seem to work

CR1.ReportFileName = gsReportPath & "ActiveCust.rpt"
CR1.SelectionFormula = "{Customer.Id} in ('1' ,'2')"
CR1.PrintReport




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Crystal Reports Selection Formula HELP
Hi

Please bare with me as i'm new to Crystal

I intend to open a report (CR8) from a VB6 application. I have a database (Access) that holds the info I want but I only want to show records that are >= the date I enter into a text box.

Just to start with I have this as my selectionformula in Crystal which does not return any faults and if i change the date between the hash's then the report changes accordingly (from within Crystal)

DateValue ({Outgoing.Date}) >= #01/08/04#

I have deleted this formula in Crystal and am now entering it at the cr1.selectionformula property in my VB code but it does not seem to like it when i open the report telling me 'You need a number or string etc here'.

Ideally i want the hashed date to be a string in VB that i enter into text box but I though I Better try to crawl before walking.

Many Thanks
Shamus

Selection Formula In Crystal Reports
With crptCreditorsList
.ReportFileName = App.Path & "
eportscreditorslist.rpt"
.PrinterCopies = intCopies
.SelectionFormula = " {Creditors.accountnumber} BETWEEN '" &
strFirst & "' AND '" & strLast & "' "
.Action = 1
End With

WHy doesn't this Selection Formula work?Please help....

Crystal Reports Selection Formula, SQL
How do I construct a SelectionFormula that uses a date in VB? I am using SQL Server 6.5.

My VB6 code looks like this:

Private Sub cmdPrint_Click()
Dim rptSql As String
Dim rptDate As Date

rptSql = "SELECT * FROM CheckRegister WHERE {CheckRegister.bank_statement_date}=Date('"
rptSql = rptSql & cboStatementDate.Text + "')"

CrystalReport1.SelectionFormula = rptSql
CrystalReport1.Action = 1
End Sub

I have tried many variations on this formula, such as using the string variable alone, in quotes, and using a date variable instead of a string variable, but nothing seems to work. I keep getting the error message "The remaining text does not appear to be part of the formula".

Does the date have to converted to a different format?
If any one has a solution, I would greatly appreciate it.

Crystal Reports: Selection Formula Of A Subreport
in my report i have a subreport. the problem exists when i want to make a selection formula of that subreport. it says that cant find the table.

Selection Formula To Subreport: Crystal Reports
I've never used the subreport feature of Crystal report and do not know how to call up a report that has them from VB. I have a report with 3 subreports. I need to have the reports only display values for a specific date. How do I pass the selection formulas to the subreports? Is it just the normal way? I use this to select the records of the primary report, but the subreports are showing all dates....


Code:
With CrysReport
.ReportFileName = App.Path & ReportName
.DataFiles(0) = App.Path & "DB.mdb"
.SelectionFormula = Selection 'defined my selection formula elsewhere
.DiscardSavedData = True
.WindowState = crptMaximized
.Destination = crptToWindow
.Action = 1
End With

Set Selection Formula For Subreport In Crystal Reports Using Visual Basic 6.0
Hello Experts,
I have designed a report using crystal reports 8.0.
There are subreports also included.front end is visual basic 6.0
I change the selection formula of the main report using
crystalreport.selectionformula. I am not knowing how to
set the selection formulae for the sub reports.
can any one help me .

Crystal Report Selection Formula
Hi,
how can i use left, right and mid ect. function in crystal report selection formula. for example:

CR.SelectionFormula = "mid({Custumer.CustCode},1,3)" ....

we can use mid funtion in VB and Substr function in SQL query, what in Selection formula?

thanks

Crystal Report Selection Formula
I have a problem with the selection formula to be used by crystal report 10. At first I just set one selection formula and it's work and now i want to used two selection formula but I do not know how to write it. Below is the code and the word highlight with red color is the formula i want to add.Can anyone teach me how..



Code:


Private Sub ListView1_DblClick()


ndLeaApprEmpNo = Trim(ListView1.SelectedItem.SubItems(3))
ndLeaApprLCode = Trim(ListView1.SelectedItem.SubItems(1))
ndLeaApprDt = Trim(ListView1.SelectedItem.SubItems(4))
'MsgBox ndLeaApprEmpNo & ", " & ndLeaApprLCode & ", " & ndLeaApprDt
Unload Me

Me.MousePointer = vbHourglass
Dim crApp As CRAXDRT.Application
Dim Report As CRAXDRT.Report
Dim strSelectionfrm As String
Set crApp = New CRAXDRT.Application
Set Report = crApp.OpenReport("C:Program FilesMicrosoft Visual StudioVB98ProjectsLeaveAppLeaveForm2.rpt")


Report.Database.Tables(1).SetLogOnInfo "SQL", "tebrauteguh", "sa", "sa"
'{tblLeaveApp.EmpNo}='" & ndLeaApprEmpNo & "' -->another selection formula i want to add, how to combine both
strSelectionfrm = "{tblLeaveApp.Date_App}='" & ndLeaApprDt & "'"

Report.RecordSelectionFormula = strSelectionfrm
Report.DiscardSavedData
Form8.CRV.ReportSource = Report
Form8.CRV.ViewReport

Form8.Show
Form6.Hide
Me.MousePointer = vbNormal


End Sub

Selection Formula In Crystal Report
Hello!

I created a parameter in CR that takes a list of values and limits selection to them, e.g.,

{fieldvalue} in {?parameter}

So, this works if I passed in (A0111,B0121) as the parameter. If the field value is any of those two, it gets listed in the report.

The problem I have is that if I pass in (A011, B012), then CR treats that as (A011*, B012*), e.g., anything that starts with A011 is pulled in. I only want, to give an example, A011 only.

What other way can I approach this to avoid the problem? Thank you for your help.

-Bahman

Selection Formula In Crystal Report
Hi everybody,

Im using crystal 4.6 basically i want to select records using the selectionformula property of crystal control
something like.
cr.selectionformula=expr1 AND expr2 And expr3
i searched a lot but found that one expression is used for selection like
cr.selectionformula=expr1

i need to select records based on multiple conditions

Any help is welcome
Thanks
Kapil

Crystal Report Selection Formula Problem
I want to pass the selection formula from the vb application which is using a crystal report control. I am using crystal report 8.5. now i have a list of 3000 items from which i am allowing the users to select the items he want. whatever items he is selecting is passed as the selection formula

"{inventoryreceiptdetail.itemid} in [" & SelectedItems & "]"

(where selectedItems contains comma seperated item codes)

The thing works fine when i select few items, but as soon as i select somewhere around 1000 codes (each code is of 10 digit) it gives me error 20515.

I tried putting that selection formula directly into crystal reports. it said, "too many items have been given to this array" . When i reduce the items, it works fine.

Can you help how to get the result even with large number of items

Crystal Report Selection Formula (Urgent)
Hi Friends,

I am using crystal report to get the list of students registered between two dates. I am using vb6 as front end I've written following code to display report:


VB Code:
With crStudList        .Connect = strConn        .ReportFileName = App.Path & "
eportsStudentList.rpt"        .ReportTitle = "Student List"        .WindowTitle = "Student List"        .SelectionFormula = "{tblStudent.RegistrationDate}>=#" & dtpFrom.Value & "# and {tblStudent.RegistrationDate}<=#" & dtpTo.Value & "#"        .WindowState = crptMaximized        .Destination = crptToWindow        .Action = 1    End With


Where DtpFrom and and dtpTo are DtpPicker control which are used to select start and end date value. I've set its format to customFormat and Custom format i've set is "dd/MM/yyyy"

Its not giving any errors but if i give 01/02/2006 as start date and 28/02/2006 as end date, it should display only students' who have register in between these two dates but it displays all who registered in 02/01/2006 or 20/01/2006 or 08/01/2006.

plz help.

thx a lot

Crystal Report - Subreports Selection Formula
please help me

i need to change All the subreport selection formula , same as the main report. I Try this code but doesn't works.


'sel is string which the selection formula
Cr.SubreportToChange = ""
Cr.SelectionFormula = Sel
iSub = Cr.GetNSubreports
If iSub > 0 Then
For iCtr = 0 To iSub - 1
StrSub = Cr.GetNthSubreportName(iCtr)
Cr.SubreportToChange = StrSub
Cr.SelectionFormula = Sel
Next iCtr
End If

that code is working only if there is only one table in a main or subreport. that doesn't work in more table !

please help me , how to do this ?

thanks very much

Change Selection Formula Of Crystal Report
Hi There,
I wanna change the slection formula for selecting records of a report (created using Crystal Reports 7) from within the vb code. I'm Able to change the formula when i'm using a string field for condition.

When I Use

    crx.replaceselectionformula "{T01.F1}='AGL'"

everything works fine and i get the preview window of crystal reports.

But when I Use

    crx.replaceselectionformula "{T01.F0}=date(2004,11,18)"
No records are listed whereas i'm having 10 records with F0 as 11/18/2004

Here

crx - Crystal Reports ActiveX Control Object
T01 - Data table
T01.F0- F0 field of T01 (Data Type : Date/Time)
T01.F1- F1 field of T01 (Data Type : String/varchar(10))

Is the code i'm using correct. If not please tell me how to select records with the given date for T01.F0 Field

Date In Selection Formula Of Crystal Report
Hello,
I m setting the range of Dates in Selection formula of Crystal Report which is adjusted in VB. Code is like this :

Qry="{GateIn.InDate} >= '" & Format(DTPFrom, "mm-dd-YYYY") & "' " _
& "And {GateIn.InDate} <= '" & Format(DTPTo, "mm-dd-YYYY") & "' "

CryRep.ReplaceSelectionFormula Qry

Its not working properly. How can be its possible ?

Thanks

Crystal Report ,how To Discard A Selection Formula?
When i pass a selection formula from form to report it works as where clause , but if i want to undo the changes made by selection formula i.e. i want the original report without the effect of selection formula how to do it?

Thnaks to all u wonderful people in advance.

How To Use Record Selection Formula With Visual Basic 6.0 And Crystal Report 11.0
Hello Crystal Report 11.0 experts users,

I am first time trying to use CR11.0 with vb6.0. Previously I was using
CR8.5 and find no problems. Now, I am trying to use new VERSION OF
CR11.0 with VB6.0 and am strucked here.
I am using below code
Dim Report As New CRAXDDRT.Application
Dim RepApp As New CRAXDDRT.Report
CRViewer1.ReportSource = Report.OpenReport(NPath & "Service
Dash11.rpt")
RepApp.RecordSelectionFormula = "{DashBoard.Year}

06"

It gives me error message saying "Basic syntax is not supported in group
or record selection formula".

I have tried all possibilities and even searched in sites but not
finding any clue in this regard.

Kindly assit me in this regard.

Regards
arun

Error On Selection Formula To Display Data On Crystal Report From SQL Database
I have a problem on selection formula to display data from SQL database on crystal report it produce an error like this:
error A number, currency amount, date, time, date-time or string is expected here



Code:

Dim Ap As New Application
Dim Rep As Report

Private Sub CRV_Click()

End Sub

Private Sub Form_Load()

Dim RepFileName
RepFileName = App.Path & "LeaveForm2.rpt"
Set Rep = Ap.OpenReport(RepFileName)
Rep.RecordSelectionFormula = "{tblLeaveApp.EmpNo}=" & ndEmpNo ->error is here
Rep.DiscardSavedData
CRV.ReportSource = Rep
CRV.ViewReport
CRV.Zoom 100

'frmcrs.Enabled = False
End Sub

Private Sub Form_Unload(Cancel As Integer)
Form6.Show
End Sub






anyone can help me....

Crystal Reports Formula
Hi!! I'm new to CR & finding it very difficult to Get into
formulas. I wud be really glad if someone could give an idea
on how to incorporate the following SQL statement on the report.


Code:
SELECT count(students.bno)
FROM Batch, Students
WHERE Batch.Bno=Students.Bno
GROUP BY Batch.bno;
I have grouped my report by Batches.
It looks like this,


Quote:




Batch Name

Student No | Student Name | ...
......
.......
......
.......

Total Student in this batch %





The formula shud come to %. I wud really appreciate any help as it
is urgent!..

Thanks!!
Mur.

Crystal Reports Formula
Hi All,

I want to create formula in Crystal report.I am very new to Crystal reports.Can Any one guide me how to Create formulas.

I want to use replace function .

Any Ideas??

Formula In Crystal Reports
In crystal report I am using sql server database, there is a value i want an another value from that fields. what i did in crystal report in formula fields i made a variable name "goldpur" the following are the command used in the formula editor

(whileprintingrecords;

shared numbervar goldpur;

goldpur := {view_invo.gld_nwt} * {view_invo.kt}/24/0.995)


view_invo.gld_nwt,view_invo.kt are both field name of the database

and the error is "A number,currency amount is required here"

Thank

Regards

Very urgent

Crystal Reports Formula Field
Hi
I got a database column which has number values like
480, 495 , 615, 630
which is equivalent to
480 = 8am (which is like 480/60=8)
495 = 8.15am
615 = 10.00am
630 = 10.15 am
i get this values from ctDEdit control, which gives numbers for time.
Now i have to show this number values as time in crystal reports. so i thought of having a formula field.
its easy to get hours and minutes from this number:
its goes like this
(615/60)=10.25
so 10 is hours
(25*60)=1500, here 15 is minutes.
can any one please help me to do this in a formula field, ie to show the time as 10.15am for number 615.
i hope im clear.
thanks
kumaarrv

Formula For Overtime In Crystal Reports
Hello,
I had a report in Crystal Reports that calculates the salaries for some employees. Which is based on a punch clock software as the report contains the punchin time and punchout time. I have managed to make a formula field as a diffdate to calculate the elapsed time between them. My question is, how can I make a formula that would do the following:
- If someone worked for more than 8 hours in one day, the time left is considered overtime. (So, say if someone stayed 11 hours it would calculate 3 hours)
Any help, suggestion, or code would be really appreciated.
Thanx in advance !

Crystal Reports Formula Captions
In VB6 via the ActiveX component you can drag'n'drop onto a form (crystal32.ocx) i can call a report and stuff a caption in against a formula field like so:

CrystalReport1.Reset
CrystalReport1.Connect = "DSN=" & SQLServer & ";" & SQLServerSetup & ";DBQ=PASS_TEMP_" & PassTempID & ";"
CrystalReport1.ReportSource = crptReport
CrystalReport1.DiscardSavedData = True
CrystalReport1.ReportFileName = REP_PATH & "Task.rpt"
CrystalReport1.SQLQuery = "Select * FROM [Task]"
CrystalReport1.ReplaceSelectionFormula ""
CrystalReport1.WindowState = crptMaximized
CrystalReport1.WindowTitle = "Pass3 Reporting"
CrystalReport1.WindowShowZoomCtl = True
CrystalReport1.WindowShowSearchBtn = True
.CrystalReport1.WindowShowRefreshBtn = True
CrystalReport1.WindowShowProgressCtls = True
CrystalReport1.WindowShowPrintSetupBtn = True
CrystalReport1.WindowShowPrintBtn = True
CrystalReport1.WindowShowNavigationCtls = True
CrystalReport1.WindowShowExportBtn = True
CrystalReport1.WindowShowCloseBtn = True
CrystalReport1.WindowShowCancelBtn = True
CrystalReport1.WindowControls = True
Call Pass3SQL_Set_department(MDIForm1.CrystalReport1)
MDIForm1.CrystalReport1.Formulas(0) = "title = " & Chr$(34) & TITLE & Chr$(34)

MDIForm1.CrystalReport1.PrintReport
MDIForm1.CrystalReport1.PageZoom (100)

Via a DLL, which I must use a different method of accessing reports:
The report runs fine, exports too. My problem is trying to set the formula caption. I have only seemed to have come across oRpt.Formulafields(1).Text Ive tried a value of 0 (zero) like the vb form version would but I get a subscript error, by setting it to 1, it does not fail, however nothing is done to the report. Am I missing something?

Thanks!

Set oApp = CreateObject("CrystalRuntime.Application")

If IsObject(oRpt) Then
Set oRpt = Nothing
End If


Set oRpt = oApp.OpenReport(ReportFileName, 1)
oRpt.MorePrintEngineErrorMessages = False
oRpt.EnableParameterPrompting = False
oRpt.DiscardSavedData


For Each Tbl In oRpt.Database.Tables
Tbl.SetLogOnInfo CrystalServerName, DBFileName, CrystalServerUID, CrystalServerPassword
Next


oRpt.SQLQueryString = SQLString


oRpt.Formulafields(1).Text = "'" & ReportTitle & "'"
'oRpt.Formulas(0) = "title = " & Chr$(34) & ReportTitle & Chr$(34)


Set ExportOptions = oRpt.ExportOptions


ExportOptions.NumberofLinesPerPage = 50
ExportOptions.FormatType = 31 'pdf
'ExportOptions.FormatType = 35 'rtf
ExportOptions.DestinationType = 1
ExportOptions.DiskFileName = OutputFileName

oRpt.Export False

Set ExportOptions = Nothing
Set oRpt = Nothing
Set oApp = Nothing

Help Crystal Reports Formula Fields????
I am using VB 6 to create a report for my application. The database I am using is Access 2003. I have created my report, and everything works perfectly. It runs and displays. Only there is one catch. As soon as I add a formula field to the report, its like the report just stops running. All I see is a blank report. As soon as I remove the formula field from the report everything works fine again. All data shows up and calculations are preformed.



This leads me to a couple possibilities. The syntax in the formula is incorrect, or I cannot add a formula field in the “Report Header a” section of a report. However I don’t believe my syntax is incorrect, and it does not make since to me why I would not be able to use a formal field anywhere in my report.



Here is what I am trying to do. I am making a report that is an Invoice. I want to be able to format the Customer Name, address, street, country etc… in the way I choose. But if it’s a company I also want the company named added. For this reason I cannot just drag the database fields on to the report because if one of the fields is empty the report will not look nice. So I made a formal field called CreateAddress. Here is the “test” code I have in that formula.

IF {tbl_customers.vc_company_name} = '' THEN

(

'blank';

)

ELSE

(

{tbl_customers.vc_company_name}

)



Now that code compiles with no errors. And the report works perfectly as long as the CreateAddress formula field is not added to the report.



Can anyone help?



Thanks in advance.

Crystal Reports Formula Problem
I am trying to use crystal reports 8.5. I have created a formula that is not working. It's very simple yet, I still can't get it to work. Below is what the formula looks like:



VB Code:
If IsNull({tblClientAddr.addAddr2}) Then   {tblClientAddr.addAddr1}Else   Trim({tblClientAddr.addAddr1}) & ", " & Trim({tblClientAddr.addAddr2})


I keep getting the error message:

"The result of the selection formula must be a boolean"

What am I doing wrong?

thanks,
Blake

Crystal Reports Formula Problem
I am trying to use crystal reports 8.5. I have created a formula that is not working. It's very simple yet, I still can't get it to work. Below is what the formula looks like:


VB Code:
If IsNull({tblClientAddr.addAddr2}) Then   {tblClientAddr.addAddr1}Else   Trim({tblClientAddr.addAddr1}) & ", " & Trim({tblClientAddr.addAddr2})


I keep getting the error message:

"The result of the selection formula must be a boolean"

I also stuck the End If statement in at the end but it still gives me that message. What am I doing wrong?

thanks,
Blake

Crystal Reports Problem In Formula
   We have encountered the problem in crystal report formula.That contains more then 254 charaters.How can i rectify when the situation like it exceeds 254 charaters without SPLITING THE FORMULA?





R.SUNDAR

Crystal Reports 6 Formula Trouble
hi,
can someone please tell me how to control crystal reports 6 formulae dynamically from code in visual basic.

this particular version of crystal reports uses a data environment addin with a form to act as the preview. I got everything else working, but cant seem to set the formula values from code.

also I cannot create a blank report, ie: a report containg only blank formula, the values will be passed from code.

any solution?

also is there any simple print preview code available.

thanks

VB6 &amp; Crystal Reports 6.0 - 20515 Error In Formula
Hope you can help.

I've created a VB6 project which runs a number of Crystal reports.
One of the reports has a number of formulas, some work OK and others don't.
One of the formulas that doesn't work is: StoreNumberVar ("Fill Weight",Sum ({DEV_FORM_CERTIFICATE_V.MG_CAPSULE}))
When running the project from my PC it runs OK.
If I run it from a test PC it gives me the following error: 20515 - Error in formula <...> The remaining text does not appear to be part of the formula.
If I change the formula to: Sum ({DEV_FORM_CERTIFICATE_V.MG_CAPSULE}) it runs OK.

Taking the advice from another thread, I reset the report like: Me.CrystalReport1.Reset, but it did not work.

I apreciate this may be more of a Crystal Reports issue, but I thought someone might have come up with this before.

Any ideas?

Thanks

Not Able To Sum The Field In Crystal Reports 9 Formula Editor
Friends,

The below formula is not working. Please point me where iam making mistake.

=========================================
whileprintingrecords;
global numbervar tottrd;
numbervar cnttottrd;
if
(
{Admin.OTC}="001"
or
{Admin.COEN} in
["Chargeable Labour + Chargable Spares",
"Chargeable Labour + Free Spares",
"Chargeable Spares + Free Labour"]
)
then
cnttottrd := {PAYMENTS.PAIDAMT}
else
cnttottrd := 0;
tottrd := tottrd + cnttottrd

=========================================

if i change
cnttottrd := {PAYMENTS.PAIDAMT}
to
cnttottrd := 1
then its working.......

Please treat this as urgent.

Thanks & Regards
Sathyguy

Crystal Reports - Sorting A Formula Field
Hi,

I've got a formula field on my report: -


Code:
//@SumQty
Sum({SALES_VIEW.SUM_QTY}, {SALES_VIEW.AR_DESCRIPTION})
I want to sort the report using this field, but can't seem to find a way.

Is it possible to do this?

Regards

Formula In Crystal Reports To Ignore Certain Data
I'm using Crystal reports 8.0
I have the report done up, but i want it to ignore records where the HIDNUM length is more than 7 and less than 2..

I cannot figure out how to use the crystal syntax.

I tried to create formula's etc, but they always error out.
the help files with the crystal reporst are useless..
I know this isnt' for crsytal report problems, but nobody seems to ever check the other forums.
I'ld paste the report already made, but dont' know if that would realy help anyone.

Crystal Reports Date Problem In Formula
here is my formula
{tblClaim.DateClosed} in {?StartDate} to {?EndDate} and
not isnull({tblClaim.DateClosed})

This is a SQL database. When I run a report with something like a StartDate 11/1/2002 EndDate 11/30/2002 It will not show anything closed on 11/30/2002 if I use 11/1/2002 and 12/1/2002 then it will show the 11/30/2002 information. Can anyone tell me what I need to do for the report to work correctly so that the user will see everything closed from 11/1/2002 11/30/2002 when he inserts those dates in the paramaters ?

BTW I'm using Crystal Reports 8.5 Developer edition inside VB6.

Thanks for any help.

Not Able To Sum The Field In Crystal Reports 9 Formula Editor
Friends,

The below formula is not working. Please point me where iam making mistake.

=========================================
whileprintingrecords;
global numbervar tottrd;
numbervar cnttottrd;
if
(
{Admin.OTC}="001"
or
{Admin.COEN} in
["Chargeable Labour + Chargable Spares",
"Chargeable Labour + Free Spares",
"Chargeable Spares + Free Labour"]
)
then
cnttottrd := {PAYMENTS.PAIDAMT}
else
cnttottrd := 0;
tottrd := tottrd + cnttottrd

=========================================

if i change
cnttottrd := {PAYMENTS.PAIDAMT}
to
cnttottrd := 1
then its working.......

Please treat this as urgent.

Thanks & Regards
Sathyguy

Crystal Reports Formula Field Charting
I am not a Crystal expert, I normally would be using VB but this project requires a report written in Crystal and I have no access to VB. Any suggestions would be great.

I have a report with a field: {StartTime} that is being pulled from a subreport: ASubrpt.rpt.

I the main report I have a formula field: {RoundedTime} that rounds the time from {StartTime} in ASubrpt to the nearest minute by fives. (example 7:22 would be 7:20).

Now, I need to graph and cross tab the count of records on the change of {RoundedTime}.

Please advise. I have even tried using the Charting on Print-Time Formulas pdf from Business Objects.


If there was a way to format the StartTime field in ASubrpt to be rounded and then create the chart in the subreport then I could insert it into the main report, but I do now know if you can format the time like that w/o a formula field. And then would it even be chartable?


Thanks in advance!

Crystal Reports 9: Formula Field Alignment
I have the following Formula Field in the detail section of a report…
If IsNull({ado.AMOUNT}) = False Then
   Formula = {ado.amount}
Else
   Formula = 0.00
End if

The Horizontal Alignment for the field is set to “Right”. For some reason when ado.AMOUNT is Null the zero value of the formula is displayed to the right but it is off by one position to the left.
See Example
AMOUNT
      $0.00
      $10.00

Anyone know why this is happen?

Crystal Reports 9, Providing Formula Value Dynamically
Hi guys,

I am working with Visual Basic 6.0 and Crystal reports 9. I know it's very easy to work with formula fields from with crystal reports designer. But i want to provide formula values from within my VB code. I can give RecordSelectionFormula from within my code but i find no way to do with a 'formula' field. I have added a text box to the report for this purpose and found that it can receive a value from within VB code via SetText property of the text box, but what i want is that i wanna give a field name from a table of the database to it. Is a geek out there to help me in this regard. I'll be highly grateful.




thankyou

Crystal Reports 10 With VB6.0 -&gt; Sorting, Grouping And Formula Fields
I have a Vb6.0 application calling crystal reports developed in 4.6. The new requirement is to get these reports in CR10 and accordingly update the VB code.

The VB code typically uses
Report1.SortFields(0) = "+{mn_contact.lastname} "
Report1.GroupCondition(2) = "GROUP3;{mn_company.customerid};ANYCHANGE;A"
Report1.SelectionFormula = {V.PROSPECT} = 0
etc etc

I require equivalent code that would be comaptible with CR10.

I tried grouping using the below code

Private Appl As New CRAXDRT.Application
Private Report As New CRAXDRT.Report
Set Report = Appl.OpenReport("C:Documents and Settingsprashanth_d01Desktopproject1Prjt1.rpt")
Report.Application.LogOnServer "crdb_oracle.dll", "vpcs.ad.infosys.com", , "MN06U", "GANESH"
Report.GroupNameFields(1).GroupNameConditionFormula = "GROUP1;{MN_COMPANY.STATE};ANYCHANGE;D"

With CrystalActiveXReportViewer1
.ReportSource = Report
.RefreshEx True
.Refresh
.Visible = True
.viewreport
End With

This returns me the report in the ascending order. The override of descending order given above in the Vb code is not being considered. The grouping in the report has it in ascending order and its returning the same.

CR gurus please help me!!

**RESOLVED**Crystal Reports Formula (PASS/FAIL)
Let's say I have a crystal report which contains the names of ten people. Each of these people has undergone five tests which result in either "PASS" or "FAIL". I am setting up my report to look like a grid. The names of each individual will go in the report header and the results of the five tests ("PASS" or "FAIL") in the details section. In order for the individual to ultimately pass they must pass all five tests. I would like to have a formula, which I would put in the report header next to the individuals name, which would result in "PASS" only if the individual passes all five tests or "FAIL" if the individual fails even one single test. Any crystal formula gurus out there?

**RESOLVED**Dynamically Change TextColor Of Formula In Crystal Reports
I have a formula which resides in a subreport. The results of this formula are either "Pass" or "Fail". I would like the textcolor for the result to be displayed in green for "Pass" and red for "Fail".

Anyone ever done something like this before. Not sure if I should be attempting to change the color in the Initialize event procedure of my main report or handling directly in the formula itself.

Date-selection With Crystal Reports In VB
I have a date in my database. I select a date on my form in VB and then I have to compare this date with the data on the crystal report.

sSelection = "{Planning.Medewerkernr} = " & CmboMedewerker.BoundText & " {Planning.datum} > " & Format(DPBegin, "dd-mm-yyyy")

WeekReport2.SelectionFormula = sSelection
WeekReport2.PrintReport

It just does nothing. But when I put it like this it worked:

sSelection = "{Planning.Medewerkernr} = " & CmboMedewerker.BoundText

WeekReport2.SelectionFormula = sSelection
WeekReport2.PrintReport

The report was shown and the selection worked. How do I work with the date as a selection with crystal reports and VB?

Really have to solve this 4 the weekend, that's why I also placed it in this forum. Please help!

Crystal Reports Selection And Viewing
Now I have code like this:

Dim sSelection As String
sSelection = " {Planning.Week} = 44"
WeekReport1.SelectionFormula = sSelection
WeekReport1.PrintReport

I'm new to Crystal reports, so I've got 4 (i hope simple) questions:

1. How can I make a selection like Planning.Week between 44 AND 48 or something like that? Can I use SQL for this?
2. How can I maximize the report that is being showed by PrintReport?
3. How can I show a selected report in the crystal report viewer?
4. How can I use a query as a source for a crystal report, and then use parameters passed from VB to this report?

Data Selection In Crystal Reports
Hi expert here...

I have 2 question :

1>. I made VB-Access project with crystal reports 8.5. The reports
appear on the CR contains the whole data from the database. Could
anybody advise how to sort the data appear on the crystal reports, and
groupped, let say in monthly basis? So that the Report appear is not
expanded to the whole database, but in selected criteria, instead. Is
filtering should be created on the VB itself?
2>. When I press the print button on the report above, the printer
dialog box appear. But when I press OK, there's nothing happened. I had
tried to restarted the PC, but still not worked. Could anybody advise?

Rgds/
Teddy

Printer Selection Using Crystal Reports Crviewer
Is there any way to ask the user which printer to print to using the crviewer component? I get the report loaded up just fine, but upon clicking the print button...



it doesn't ask which printer to print to, just automatically selects the default.

Any suggestions?



Edited by - eps on 8/23/2004 11:16:49 AM

Case Select In Report, Select Expert Formula For Crystal Reports RDC
I am using Crystal 8 RDC in my VB app. I run a number of reports with paramaters which run beautifully. Typicall when I Enter a Selection formula in the Select Expert it will look something like:

{ado.Issuer} Is like {?IssuerParm}

Can anyone give me an example of how to use an If statement or a Case Select in the Select Expert of Crystal Reports RDC?

**RESOLVED**Crystal Reports Date &"&" Formula (Easy One I Think)
All I need is a simple date formula that shows the date if a date exists in the table/field. If a date has not been entered in the table/field, I would like it to show as "N/A".

Here is the formula I have tried:

if {tblPrimDls.PDLine} = "" then "N/A" else {tblPrimDls.PDLine}

tblPrimDls.PDLine is a Date/Time field in MSAccess Database.

Error I am getting:

A date is required here. Focus is then given to ""

CR 8.5 Selection Formula
I'm trying to build a selection formula in cr 8.5. I pass the report parameters based upon the users choice of key to use. Here is the formula in CR. I pass RecordKey, FirstPart, Secondpart. All have values I tested it and displayed the values on the report itself. All of my parameters are string value.

if {?ReportKey} = "1" then
if {?FirstPart} <> {?SecondPart} then
{BASE.ACCOUNT_NO} in {?FirstPart} to {?SecondPart}
else
{BASE.ACCOUNT_NO} = {?FirstPart}
else if {?ReportKey} = "2" then
if {?FirstPart} <> {?SecondPart} then
{BASE.MAP_BLK_LOT} in {?FirstPart} to {?SecondPart}
else
{BASE.MAP_BLK_LOT} = {?FirstPart}
else if {?ReportKey} = "3" then
if {?FirstPart} <> {?SecondPart} then
{BASE.ROUTING_NO} in {?FirstPart} to {?SecondPart}
else
{BASE.ROUTING_NO} = {?FirstPart}
else if {?ReportKey} = "4" then
if {?FirstPart} <> {?SecondPart} then
{BASE.PROPERTY_LOCATION} in {?FirstPart} to {?SecondPart}
else
{BASE.PROPERTY_LOCATION} = {?FirstPart}

When I use any RecordKey other than "1" for account no records are returned. Am I way off base here? How can a fix this problem? Any advice would be appriciated.

Thanx in advance.

Selection Formula
hello friends,

Can you tell me how to select salesmanwise sales report. I hv list of salesmans in one combo box. Or can anybody tell me hw to use Selection Formula of Record.

Thanks.

ME

Copyright © 2005-08 www.BigResource.com, All rights reserved