Not able to change decimal places as per code!

orsonros

New member
Local time
Today, 06:46
Joined
Mar 14, 2006
Messages
6
Hi!
I have written this code to change decimal places. Am I on the right track? On running the code the decimal place remains alway on 4 and does not change to 2 as required by the code. What am I doing wrong? Is there any other setting to be done? Either in the Table or the Forms text box?

Please Help!

Private Sub txtEntryPrice_AfterUpdate()
Dim strA As String
Dim strB As String
Dim strC As String
Dim strG As String


strA = "EUR/USD"
strB = "GBP/USD"
strC = "NZD/USD"
strG = "USD/JPY"

If [cboCurrency] = strG Then
Format ([txtEntryPrice].DecimalPlaces = 2)
End If
If [cboCurrency] = strA Then
Format ([txtEntryPrice].DecimalPlaces = 4)
End If
If [cboCurrency] = strB Then
Format ([txtEntryPrice].DecimalPlaces = 4)
End If
If [cboCurrency] = strC Then
Format ([txtEntryPrice].DecimalPlaces = 4)
End If

End Sub



Orsonros
 
not "Format ([txtEntryPrice].DecimalPlaces = 4)"
use "Me.txtEntryPrice.DecimalPlaces = 4"

try...

If [cboCurrency] = strG Then
Me.txtEntryPrice.DecimalPlaces = 2
Else:
If [cboCurrency] = strA Or [cboCurrency] = strB Or [cboCurrency] = strC Then
Me.txtEntryPrice.DecimalPlaces = 4
End If
End If
 
Yes, Goppo.....got the message, thanks!

I rewrote the code just as you had suggested, but nothing happens, meaning the decimal places remains same.
If I enter a value as 2 places it takes and changes all records to 2 places in the field. If value entered is 4 places it change all record in this field to 4.
What I need is to change decimal 2 places for only one particular currency.

Is it correct to run the code in "After upDate()"?
any setting required in TABLE or text box on FORM

Thanks
Orsonros
 
look at this and tell me if i undestud corectly
 

Attachments

Yes, Goppo.....you understood correctly.

It is working perfectly, I had to blank the decimal & format in the text box property.

thanks

Orsonros
 

Users who are viewing this thread

Back
Top Bottom