PDA

View Full Version : show numbers with commas



av8tordude
01-23-2011, 11:32 AM
I have this code that inputs times each digit I type. Can some assist in editing the code to allow me to enter numbers with commas.

i.e
1000 = 1,000
10000 = 10,000
100000 = 100,000

Select Case Len(Me.txtReport)
Case 1
Me.txtReport = Format(Me.txtReport, "00\:00")
Case Is > 1
v = Replace(Me.txtReport, ":", "")
Me.txtReport = Format(Val(v), "00\:00")
Case Else
End Select


Thank you for your help

mdmackillop
01-23-2011, 12:22 PM
How about


Me.txtReport = Format(CLng(Me.txtReport), "00\:00")

av8tordude
01-23-2011, 12:39 PM
I'm not quite sure I understanding your post. Could you elaborate? The code I have allows me to type in time, one digit at a time. What I'm trying to do is type in a number.

i.e. Each number represents me typing each character...

1
10
100
1,000
10,000
100,000

mdmackillop
01-23-2011, 12:48 PM
As I understand it, you want to enter either 1000 or 1,000 to obtain a result.

av8tordude
01-23-2011, 12:59 PM
ok...in your example, it still displays time. The code I presented is fine for time display, but i want to be able to type in only number formats (No time format)

Artik
01-23-2011, 04:50 PM
With native separators (thousands and decimal) like this:
Me.txtReport = Format((Me.txtReport), "#,##0.00")
Artik