Is there a way to format a currency field in a table to a negative value?
Thank you for any help
Format a currency field in a table to a negative value
-
- 4StarLounger
- Posts: 582
- Joined: 06 May 2012, 20:05
-
- Administrator
- Posts: 78582
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Format a currency field in a table to a negative value
Sorry, I don't understand the question. What exactly do you want?
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 582
- Joined: 06 May 2012, 20:05
Re: Format a currency field in a table to a negative value
I have 2 currency fields that will always be negative values (bank charges) and I wondered if there was a way to make them negative from the get go, instead of having to remember to type in the minus sign in the form.
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Format a currency field in a table to a negative value
You could just type something like this into the fields Format property: "R -"#,##0.00Diana van den Berg wrote:I have 2 currency fields that will always be negative values (bank charges) and I wondered if there was a way to make them negative from the get go, instead of having to remember to type in the minus sign in the form.
Just remember...this is just a display format. To actually convert the value to negative, you need to update it with a query or update table (multiple the value with -1).
Last edited by Rudi on 07 Mar 2014, 14:47, edited 1 time in total.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78582
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Format a currency field in a table to a negative value
You wouldn't want to do that in the format of the field - you want the value of the field to be negative, not just its display.
You cannot do that in the table, but you can use the After Update event of a text box bound to the field on a form to make the value negative if the user forgot to do so. Let's say you have a field named BankCharge:
You cannot do that in the table, but you can use the After Update event of a text box bound to the field on a form to make the value negative if the user forgot to do so. Let's say you have a field named BankCharge:
Code: Select all
Private Sub BanckCharge_AfterUpdate()
If Me.BanckCharge > 0 Then
Me.BanckCharge = -Me.BanckCharge
End If
End Sub
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 582
- Joined: 06 May 2012, 20:05
Re: Format a currency field in a table to a negative value
Yes, that was what I meant, Hans, though I didn't express it well.
Thank you so much for that! It works perfectly!
I am just curious to know why nothing is displayed in the AfterUpdate property for the unbound fields.
Thank you Rudi. I expressed it badly. I did mean the value.
Thank you so much for that! It works perfectly!
I am just curious to know why nothing is displayed in the AfterUpdate property for the unbound fields.
Thank you Rudi. I expressed it badly. I did mean the value.
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Format a currency field in a table to a negative value
The After_Update property is an event property where a function or code usually goes.
Unless you attach something to it, it would always be blank (for bound or unbound fields).
Unless you attach something to it, it would always be blank (for bound or unbound fields).
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- 4StarLounger
- Posts: 582
- Joined: 06 May 2012, 20:05
Re: Format a currency field in a table to a negative value
Thanks for the explanation, Rudi.