Solved

Run time error 20515

Posted on 2012-03-17
11
736 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

910 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now