Solved

Run time error 20515

Posted on 2012-03-17
11
738 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
This is an explanation of a simple data model to help parse a JSON feed
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

773 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