Solved

Run time error 20515

Posted on 2012-03-17
11
735 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
Comment Utility
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
Comment Utility
Thanks
it says string required here
and cursor shows me before 0
all the fields are number
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
What is the OpnBal fomula?

mlmcc
0
 
LVL 1

Author Comment

by:crystal_Tech
Comment Utility
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
Comment Utility
What is OpnBal in the report?
Since you replace it, the replacement is causing the problem

mlmcc
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:crystal_Tech
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Can you upload the report and show the code you use to run it?

mlmcc
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
A short article about problems I had with the new location API and permissions in Marshmallow
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 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

16 Experts available now in Live!

Get 1:1 Help Now