Controlling formatting and decimal places when combining text boxes (1 Viewer)

DataBass

Registered User.
Local time
Yesterday, 22:22
Joined
Jun 6, 2018
Messages
68
In the footer of a report, I have 3 text boxes, txtIncome, txtExpenses and txtPercent".

txtExpenses is a calculated control which refers to a text box in the detail section which gets its value from a subreport. It is formatted as currency, 2 decimal places

txtPercent= [txtExpenses]/[txtIncome]. It is formatted as percent, 1 decimal place.

I would like to combine txtExpenses and txtPercent into one box. I have done this by creating another text box with the following control source: =[txtExpenses] & " - " & [txtPercent]

However, in the new text box, the formatting is lost and the decimal places aren't consistent.

For example, instead of $2665.00 51.5%, I now get 2665 - 0.5157731759241
I have added the $ and % symbols but I don't know how to get the decimals correct.

Any suggestions?
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 16:22
Joined
Jan 20, 2009
Messages
12,849
Code:
= Format([txtExpenses], "$#,###.00") & " - " & Format([txtPercent], "#.#%")
 

DataBass

Registered User.
Local time
Yesterday, 22:22
Joined
Jun 6, 2018
Messages
68
Pure genius. Thanks for that.
 

Users who are viewing this thread

Top Bottom