How to add currency and round 2 decemial place in a button

Nick.NZ

New member
Local time
Today, 15:00
Joined
Nov 14, 2021
Messages
15
Hi guys,

I've got a Save button that once clicked displays the Order total. I'm just not sure how to add the currency (dollars), and round to two decimal places. If it was a text box there is an option in the access interface, since it's a button i presume it needs to go into the code.

In the on click event macro I've simple got:

=[Test4 subform1].[Form]![Text18]

Text18 being the text box in the sub form the order total is calculated to.

See screenshots below if need be.

Thanks,
Nick
 

Attachments

  • access1.JPG
    access1.JPG
    52.6 KB · Views: 345
  • access2.JPG
    access2.JPG
    20.3 KB · Views: 337
Put this in the Format Property of the textbox.

$#,##0.00
1637828885235.png
1637828913133.png


Hasn't worked unfortunately.

The same goes if i try and change the format with the drop down menu manually.

This only works when the event is coming from another text box. But because it's coming from a button with a macro it doesn't seem to change it.
 
Is there a way to embed the code into
=[Test4 subform1].[Form]![Text18] ?
 
On a bound form, a textbox in the header or footer can Sum a field in the recordset with:
=Sum(fieldname)

I don't know why the Format property isn't working. I don't have Access at home to test it.

Maybe it needs the $ escaped?
\$#,##0.00
 

Users who are viewing this thread

Back
Top Bottom