August 18, 2008 at 12:23 pm
I have a calculated field that I cannot get formatted. I would like it to be formatted like this: "###,###,###,##0.00"
I have tried putting that in the Format property but it errors out. I've tried N2 and it errors out. I've tried putting it around my code call and it errors out:
=Code.CalcSubTotal(ReportItems!txtBegBal.value,ReportItems!txtDebitAmount.value,ReportItems!txtCreditAmount.Value,ReportItems!txtAcctNoHiddenForCalc.value,CInt(ReportItems!txtSubAccount.value))
like this:
=Format(Code.CalcSubTotal(ReportItems!txtBegBal.value,ReportItems!txtDebitAmount.value,ReportItems!txtCreditAmount.Value,ReportItems!txtAcctNoHiddenForCalc.value,CInt(ReportItems!txtSubAccount.value)),"###,###,###,##0.00")
and it errors out.
This code is in Code in Report Properties:
Function CalcSubTotal(BegBal as double, Debits as double, Credits as double,Acct as integer, Sub_Acct as Integer) as double
dim RAccount as integer
dim RSubacct as Short
dim balance as double
dim counter as integer
If RAccount <> Acct or RSubacct <> Sub_Acct
Counter = 0
End If
If Counter = 0 Then
Balance = BegBal + Debits + Credits
Else
Balance = Balance + Debits + Credits
End if
Counter = Counter +1
RAccount = Acct
RSubacct = Sub_Acct
Return Balance
End Function
Does anyone have a solution as to how I can get this box formatted? Thanks.
August 18, 2008 at 1:00 pm
Why not have the function pass it back as a correctly formatted string? Are you doing more math with the result?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
August 18, 2008 at 1:17 pm
No, I'm not doing more math. I tried putting the same Format string around my results in the Code piece and that didn't work either.
Ever since I formatted 3 textboxes (debits,credits and beginning balances), I'm getting an error that the code is getting an incorrect input value.
I thought formatting would be the least of my worries...
August 18, 2008 at 1:28 pm
I got it figured out. It must have been my code because now all the N2 formatting is working fine. Thanks.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply