Solved

Access 2010 - report text box formatting

Posted on 2013-11-27
6
942 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 25

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 50

Expert Comment

by:Gustav Brock
ID: 39683234
This should work:

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

/gustav
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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 50

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

739 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