Solved

Access 2010 - report text box formatting

Posted on 2013-11-27
6
926 Views
Last Modified: 2013-12-04
I have a report that shows tax amounts in various currencies.

I want the tax amount to be formatted with square bracketing and the variable currency symbol shown like:
[$100.00]
[€250.00]
[£500.00]

At the report detail format event  I use vba:

Me!sInvoiceTax = "[" & GroupCurrencySymbol & Format(InvoiceTax, #,##.0.00) & "]"

At the group footer format event I tried to use vba:

Me!txtTotalInvoiceTax = "[" & GroupCurrencySymbol & Format(sum([InvoiceTax]), "#,###,##0.00") & "]"

but function sum is not recognised.

Instead I would prefer to have a bound text box in the group footer with control source:
sum([InvoiceTax]
and use the property sheet text box format property:
"[ $"#,##0.00"]"  but to change the $ to be my variable GroupCurrencySymbol

but I don't know how to set up the text box format property to do this.  How can I achieve the formatting I need, either via the property sheet or vba.
0
Comment
Question by:MonkeyPie
6 Comments
 
LVL 24

Expert Comment

by:chaau
ID: 39682800
Have you tried to use this expression as your format string:
"[ " & [GroupCurrencySymbol] & "#,##0.00" & "]"

Open in new window

0
 

Author Comment

by:MonkeyPie
ID: 39682816
I added the following to the group footer format event:
 
  Me.txtSumNetInvoice.Format = "[ " & [GroupCurrencySymbol] & "#,##0.00" & "]"

Open in new window

It didn't work.  I just got 100.00 with no formatting at all.
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 39683234
This should work:

Me!txtTotalInvoiceTax = Format(Sum([InvoiceTax]), "\[\" & [GroupCurrencySymbol] & "#,##0.00\]")

/gustav
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:MonkeyPie
ID: 39684162
Sum is an SQL function, not VBA, so I can't use the code above.


In my initial post I wrote...
At the group footer format event I tried to use vba:

Me!txtTotalInvoiceTax = "[" & GroupCurrencySymbol & Format(sum([InvoiceTax]), "#,###,##0.00") & "]"

but function sum is not recognised.
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 39684863
That's right. Try this instead with an additional textbox:

Me!txtSumInvoiceTax with this controlsource:
=Sum([InvoiceTax])

Me!txtTotalInvoiceTax = "[" & GroupCurrencySymbol & Format([txtSumInvoiceTax]), "#,###,##0.00") & "]"

/gustav
0
 
LVL 20

Accepted Solution

by:
clarkscott earned 500 total points
ID: 39685000
Sounds like the "sum" isn't working.
How about creating an invisible text box and add the sum function to it's control source.  Then, instead of sum(InvoiceTax) in your formula (above) you simply use the new text box you created.

Perhaps, trying this will discover why your sum doesn't work.

Scott Clark
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

777 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