Solved

Run time error 20515

Posted on 2012-03-17
11
739 Views
Last Modified: 2012-04-03
Run Time error '20515'
Error in formula <CM_OPN_AMT>.
'IF {@OpnBal} = '0' THEN ({Temp_Clnt_PrvAmt.CMAmt}) - ({Temp_Clnt_PrvAmt.Amt_Rcvd})'
A number is required here.

Formula i am using is

IF {@OpnBal} = '0' THEN ({Temp_Clnt_PrvAmt.CMAmt}) - ({Temp_Clnt_PrvAmt.Amt_Rcvd})

Please help.
0
Comment
Question by:crystal_Tech
  • 6
  • 5
11 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 37733311
Try

IF {@OpnBal} = 0 THEN ({Temp_Clnt_PrvAmt.CMAmt}) - ({Temp_Clnt_PrvAmt.Amt_Rcvd})

Are the other fields numbers or strings?

mlmcc
0
 
LVL 1

Author Comment

by:crystal_Tech
ID: 37733325
Thanks
it says string required here
and cursor shows me before 0
all the fields are number
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37733415
What is the OpnBal fomula?

mlmcc
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 1

Author Comment

by:crystal_Tech
ID: 37733522
getting OpnBal value from vb form

prvOpnBal = Val(Rs2Clnt.Fields(0)) - Val(Rs2Clnt.Fields(1))
CrystalReport1.Formulas(5) = "OpnBal = '" & prvOpnBal & "'"
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37733597
What is OpnBal in the report?
Since you replace it, the replacement is causing the problem

mlmcc
0
 
LVL 1

Author Comment

by:crystal_Tech
ID: 37733648
OpnBal is a value i wanted to show in the report.
value from database.
then i wanted to calculate this OpnBal value with "Sum of CLNT_Ledger.CMAmt"
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37733752
You say the error is in this formula

IF {@OpnBal} = '0' THEN ({Temp_Clnt_PrvAmt.CMAmt}) - ({Temp_Clnt_PrvAmt.Amt_Rcvd})

Need to know if that formula is part of the report or the formula you are changing from code?

If it is not the formula you are changing then what is the original formula?

mlmcc
0
 
LVL 1

Author Comment

by:crystal_Tech
ID: 37734524
as far as i tried with different different ways
now

///trying to add Sum ({CLNT_Ledger.CMAmt}, {CLNT_Ledger.conName}) in @OpnBal
formula for CM_OPN_AMT is

IF {@OpnBal} = '0' THEN Sum ({CLNT_Ledger.CMAmt}, {CLNT_Ledger.conName}) else
({@OpnBal}) + Sum ({CLNT_Ledger.CMAmt}, {CLNT_Ledger.conName})

it says string is required here cursor shows between + and Sum
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 300 total points
ID: 37735089
OpnBal is apparently a string value.

Is it a formula or a parameter?

Try

Simplifying this to

Val({@OpnBal}) + Sum ({CLNT_Ledger.CMAmt}, {CLNT_Ledger.conName})

If OpnBal = '0' then the Value is 0 and doesn't change the sum

mlmcc
0
 
LVL 1

Author Comment

by:crystal_Tech
ID: 37735450
Tried but
On refresh report, no error
but from code
giving me run time error 20515
Please check attached File
RUN-TIME-ERRRO-20515.doc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 37735616
Can you upload the report and show the code you use to run it?

mlmcc
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

808 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