Solved

Access 2010 - report text box formatting

Posted on 2013-11-27
6
935 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sum in Split Form 17 28
default combobox value 12 18
Create Incremental Count and Reset Counter for Field Change in Access 14 41
DataType for bit Comparison 11 21
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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 …

820 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