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




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.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
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

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....

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 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 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 & 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

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.

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

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

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

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?

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 .

**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.

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 ""

Data Reports Active Reports Or Crystal Reports
Hi all

I am really stuck here and i need help urgently
I have to call three tables in a row to print a single invoice entry
noe the problem is if the do it by calling single tables then there is a problem that it is nopt going to print the last order which is filled.Is there is any way it can be done through using sql command or something.
Secondly if i use max order in sql then i would not be in a position to print order after searching for it


Thanx

Crystal Formula
What is wrong with the following???

if {?Gender} = "Male or Female" then formula =
{Customer.Interest1} = {?PM_Interest} or
{Customer.Interest2} = {?PM_Interest} or
{Customer.Interest3} = {?PM_Interest}
Else formula =
{Customer.Gender} = {?Gender} and
{Customer.Interest1} = {?PM_Interest} or
{Customer.Gender} = {?Gender} and
{Customer.Interest2} = {?PM_Interest} or
{Customer.Gender} = {?Gender} and
{Customer.Interest3} = {?PM_Interest}
End if

Thanks

Crystal Formula
Check this.

a) I have two several tables on crystal report (8.0)
b) I have the same table (periodo_publicidad) twice one with the real name and the other one with and alias (periodo_publicidad_2)

c)From VB I am passing a formula to Crystal like this

sqls = "{Periodo_publicidad.pep_Fecha_desde} <= # " & txtfecha & " # " _
& " and # " & txtfecha & " # <= {Periodo_publicidad.Pep_fecha_hasta} " _
& "and {Periodo_publicidad.pep_tipo_rango} = 'I'" _
& "and {contrato.ren_renglon} <> 'C' "
'& "and exists (select 'x' " _
& " from periodo_publicidad as periodo_publicidad_2)"

If this possible?
What is wrong?

Crystal Formula With SQL
I am using sql2000 and i am passing this as a formula to crystalreport.

dfecha = CDate(txtfecha)
sqls = "{periodo_publicidad.pep_fecha_desde} >= " & dfecha & "" _
& " AND {periodo_publicidad.pep_fecha_hasta} <= " & dfecha & "" _
& " AND {periodo_publicidad.pep_tipo_rango} = '" & sI & "'"


but it says that a date is required. Why?

In Crystal Reports, How To Display Financial Reports (P & L, Balance Sheet Etc.) In Columnar Format
Dear All,

I am developing a Financial application using VB6, MS-Access & Crystal Reports 8.5. I am facing problems in certain reports. Some of the reports like Profit & Loss and Balance Sheet require the output to be printed in columnar format.

I have tried giving subreports for each section, i.e.; Assets & Liabilities, but then, the output is not coming in order as per the groups. The problem is even more where there are sub-sections in the right side column & left side column for example in Profit & Loss, where there are sub-sections for Gross Profit/Loss and Net Profit/Loss. In such cases, how to bring the total amount fields at the same horizontal level.
I hope someone can help me how to do the above.

Thanks in advance.

Best Regards
Mahesh

Change The Database Location In Crystal Reports Sub Reports From VB During Runtime
I have several reports that were designed in Crystal Reports that have the DB location changed during runtime. When I move my database, or choose another copy of the DB that has a lot of records in it, my reports don't fire. I need to be able to Verify the database during runtime. I'm usiung VB6.0 and CrystalReports8.5 I've tried using Crystal's "Verify On Every Print" function, but I haven't had any luck. Here is the code I am using.

MyLocation = "C:mydatabase.mdb"
CRPE321.ReportFileName = "c:aptcom
eports eninfo.rpt"
CRPE321.DataFiles(0) = MyLocation
CRPE321.ParameterFields(0) = "ThisKey;" & Who.Text & ";true"
CRPE321.PrintReport

Also, does anyone know if changing the DataFiles location during runtime also effects the subreports. I don't think it does, but any input would be appreciative.

Need To Understand Data Reports - Heard That Crystal Reports Were Slow
I have two questions:

1.) I was going to take a step forward to learn how to use crystal reports but I heard that on a website they are viciously slow. Is that true or is there a way around that with coding?

2.) I have been using Access reports through Visual Basic 6.0 with the following code - thanks for the tremondous help of everyone on this website:

Code:
appAccess.OpenCurrentDatabase SERVER & "disp-1_be.mdb"
appAccess.DoCmd.Maximize
appAccess.DoCmd.OpenReport "oalog", acPreview
appAccess.Visible = True

The reports work great UNTIL I came accross a situation where the report is based off of the data entry of the user. oalog is a monthly report and in the query it automatically pulls the current month with the following query:

Code:
SELECT oalogallmonths.ctsbranch, Count(oalogallmonths.Amount) AS [Total Of Amount], oalogallmonths.GivebyName, oalogallmonths.United, oalogallmonths.Mayflower, oalogallmonths.Other, oalogallmonths.Tord, oalogallmonths.CURRENTDATE, oalogallmonths.Amount, oalogallmonths.Month1, oalogallmonths.ORDER
FROM months, oalogallmonths
WHERE (((months.monthID)=[oalogallmonths].[Amount]))
GROUP BY oalogallmonths.ctsbranch, oalogallmonths.GivebyName, oalogallmonths.United, oalogallmonths.Mayflower, oalogallmonths.Other, oalogallmonths.Tord, oalogallmonths.CURRENTDATE, oalogallmonths.Amount, oalogallmonths.Month1, oalogallmonths.ORDER
HAVING (((oalogallmonths.Amount)=11;

If you notice the records are pulled HAVING the 11th month in there.

If I want the user to ENTER the month I know that I must change the last line to:


Code:
HAVING (((oalogallmonths.Amount)=[ENTER MONTH]));

But a user might type January or 12/2003, etc...

so I made a combobox named ListMonth of the 12 months.
Then I made the change from:


Code:
HAVING (((oalogallmonths.Amount)=11;
to

Code:
HAVING (((oalogallmonths.Amount)=ListMonth.ListIndex + 1));

The only problem is that I keep getting a message box asking for ListMonth.ListIndex + 1.

My question is in the above code that defines appAccess.DoCmd.OpenReport "oalog"...
is there a way to change the RecordSource of the report to pull from my own query instead of the Access Query?

Thanks,
Stephen

Crystal Reports - Upgraded To 8.5, Now Reports Written In 8.0 Wont't Work!!!
My reports are crashing when I run them on a machine with CR8.5, but they work fine on cr8.0. They crash inside the .DiscardSavedData Routine.


Does anyone know why or what I can do...

I call the report.Printout routine and right after I call the
.DiscardSavedData. The report is still printing out in debug mode.


Please help. Is my syntax wrong. The help file says I can only use Printout and DislcardSavedData in "formatting idle" mode. I don't know what this this???? The .PrintOut routine works but not the discardsaveddata.


Thanks,

Any help is appreciated.


M

How To Use Crystal Reports To Make The Dynamic Reports?(I Can't Use The Design Expert To D
  How to use Crystal Reports to make the dynamic reports?(I can't use the design expert to design the report,because the data source with different fields is unknown in design time.)
     Hello all!
     I use the dynamic generating MS Access table as the Data Source of Crystal Report.
How to use the Crystal Reports to display the data of the dynamic generating MS Access table?
     Thanks All!
                                                    China






Edited by - dehuiworkroom@hotmail.com on 12/17/2003 9:37:59 PM

Change The Database Location In Crystal Reports Sub Reports From VB During Runtime
I've created a Report Viewer that displays Crystal Reports 8.5 reports. I have the DB location in Crystal Reports changed during runtime, but I can't get the location to change in the subreports at runtime as well. Also, by using my method of calling the reports, I can't get VB to pass any parameters to the Main report. Below is the code that I am using. I'm using VB 6.0 and CR 8.5

Dim MyNewKey
MyNewKey = Who.Text

' On Error GoTo KeepGoing

MyLocation = GetStringValue("HKEY_LOCAL_MACHINESoftwareAptCom", "AptCom DB Path")
strReportFile = "c:aptcom
eports eninfo.rpt"

Set CRReport = New CRAXDRT.Report
Set CrxApp = CreateObject("crystalruntime.application")
Set CRReport = CrxApp.OpenReport(strReportFile)
' Set CRReport.ParameterFields(0) = "ThisKey;" & MyNewKey & ";true"

' KeepGoing:

For Each dbTable In CRReport.Database.Tables
dbTable.SetLogOnInfo "", MyLocation, "", ""
dbTable.Location = MyLocation
dbTable.SetDataSource MyLocation
Next dbTable
CRReport.Database.Verify


CRReport.SQLQueryString = strSQL

frmReportViewer.Show
frmReportViewer.CRViewer1.ReportSource = CRReport
frmReportViewer.CRViewer1.ViewReport

Set CRReport = Nothing
Set CrxApp = Nothing
Set CRReport = Nothing

&gt;&gt;&gt;&gt;
I've tried using this method:

MyLocation = "C:mydatabase.mdb"
CRPE321.ReportFileName = "c:aptcom
eports eninfo.rpt"
CRPE321.DataFiles(0) = MyLocation
CRPE321.ParameterFields(0) = "ThisKey;" & Who.Text & ";true"
CRPE321.PrintReport

But, I can't get Crystal Reports to verify the database during runtime. The first way verifies the DB, but won't change the DB location of the subreports or pass parameters to the reports.

Any help would be appriciative.

Crystal Formula Field
Hello All

I am trying to get a formula field to work in Crystal Reports V7

The formula lookes like this:


Code:
'Batch Number ' + Totext({Route_ttx.Batch ID})
The problem I have is that {Route_ttx.Batch ID} is numeric and no matter how much I try I cannot get it to format correctly within the formula.

I get a resulting field 'Batch Number 1,234.00'

What I really need is 'Batch Number 1234'

I cannot seem ot be able to format the number correctly before it is converted into a string and appended to the 'Batch Number ' text.


Any ideas?

Crystal Report Formula Help
i dont know where to begin... i have created this report and would like to have when the user inputs a begdate and enddate and state to show $totals of that criteria.
the report does show the beg date and end date and the state , but the only thing wrong it calculated the total cost of all the states income in the grand total of the report, i only want to have the state to show the total of that kind
ie if user inputs begdate = 1/1/03 and end date (today) and select state CA i want the report to show the totalcost income of that state between those dates, it only shows the grand totalcost of all states right now....
i am using win xp, vb6 and crstal report 4.6? that is on the vb cd

i dont know if i need to code in vb or put a formula in crystal???? HELP please


StartDate = InputBox("Enter Starting Date To Print:", "Date Entry", Date)
EndDate = InputBox("Enter Ending Date To Print:", "Date Entry", Date)
State = InputBox("Enter Code of State To Print:", "State Entry")
If StartDate = "" Then
Else
If EndDate = "" Then
Else
If State = "" Then
Else
CrystalReport1.ReportFileName = "\Server1salestx.rpt"
CrystalReport1.GroupSelectionFormula = "{OrderStatus.Date} >= " & "Date(" + Format$(StartDate, "yyyy,mm,dd") + ") and {OrderStatus.Date} <= " & "Date(" + Format$(EndDate, "yyyy,mm,dd") + ") and {OrderStatus.Order_State} = " & "'" + (State) + "'"
CrystalReport1.Action = 1
End If
End If
End If
End If

Crystal Report 8.5 Formula
greetings,
I work with VB6 sp5, SQL Server2000, Crystal Reports 8.5
Trying to create a certain report, I need to check the values of some table fields and accordingly display some notes.
my table contains, among all others, two int-type fields called HoursIn and MinutesIn. I would like to create a formula (i guess) to check these values.
If both are 0 then I would like to display "CLOSED", otherwise diplay the HoursIn and MinutesIn values.

can someone help me with this please?
should I have an empty text field and feel it accordingly? or insert the formula field and have it feeled? how can it be done? I tried but with no success.
thank you in return.

Formula In Crystal Report
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??

Simple Formula In Crystal
Here is my formula

WhilePrintingRecords;
numberVar x;

if {LOAN.CLOSED} = -1 then
x = x + 1;

"Total loans closed:" & x

The "closed" field in the "loan" table contains 0 or -1, when I refresh my report it returns a 0.00.

On the report it shows about 6 records with a -1.

Anyone know?

Chng In Crystal Formula From VB
hi,
I am using crystal 8.5 & vb6
I have stored one formula XyesNo in crystal which is having value true.

Now Want to Ask one question in VB and accordingly want to change the value of XYesNo, say from True to False.

I hv come to know that we can change this by
---
CrystalReport1.Formulas(0) = "XYesNo= 'True'" Or

CrystalReport1.Formulas(0) = "XYesNo= 'False'" Or
---

but in crystal report 8.5 there is no formulas, the only available are
formulasyntax & formulafields. The member who gv me the solution is using crystal 7.0,

Tell me how to do

Thanks

Error On Formula (crystal)
hi,
I want to print city and pincode,
if pincode exist then city and pincode else print city only.
the following the code of the formula I wrote in crystal but
the problem is it prints city and pincode only when pincode is
not blank, it should also print city name even if pincode is blank,
Pls check the code

---
if {custmaster.pincode1} = "" then
{custmaster.city1}
else
{custmaster.city1} + "-" + {custmaster.pincode1}
---

thanks & regards

Crystal Report 8 Formula?
I'm having problems grouping a formula field. I have been told that you cannot create a group if the formula has the WhilePrintingRecords within the code. I have 4 formulas that help me get the subtotal(so to speak) for the Total Time(text object). Not a field with in database.

Formula1: WhilePrintingRecords;
NumberVar RunningTotal;
RunningTotal := 0
Formula2: WhilePrintingRecords;
NumberVar RunningTotal;
RunningTotal := RunningTotal + {@TimeDiff}
Formula3: WhilePrintingRecords;
NumberVar RunningTotal;
RunningTotal;
The 4th formula is just attaching the word minutes to formula3 total. Now is there another way to get a total for this field without using the WhilePrintingRecords, so that I can make a group out to the total field?

Thanks for any help jeffro!

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