Formatting Currency in a non-numeric Text field (1 Viewer)

Kronix

Registered User.
Local time
Today, 12:04
Joined
Nov 2, 2017
Messages
102
Normally, a person would use a numeric field in a table formatted as currency to enter pound, dollar, or euro amounts. But I want to use a text field, since the field will be used to contain separaters, such as dashes, in certain records. It also needs to be stored directly in the table (not a query) so that I can use alignment with listboxes (that's another topic some of you might not know about). I don't want to use ActiveX Listview yet since I'd have to rewrite a bunch of code for that.

So the question is, how do I format entered numbers into currency form, for example if I enter "245,3" (in Europe) it will convert and save it as "245,30 €" (in this case the comma is the decimal symbol), but do it using a textbox control linked to a field in a table of type Short Text, (which means it will need to be a manual converted into the text string)? I am well aware that the "easy" way to do this is to make the table field of type Currency.

I will also need to perform a check that the text entered is indeed a valid number -- although an easy way I've found to check for this is simply to check whether the text entered in the textbox control is > 0 (assuming I don't want negatives); it will give a different built in error for both negative numbers and non-numeric entries without interrupting the program.
 

Wayne

Crazy Canuck
Local time
Today, 06:04
Joined
Nov 4, 2012
Messages
176
To format as currency, try

Code:
Format(Me.yourfieldname.Value, "$##,##0.0")
 

Users who are viewing this thread

Top Bottom