Number formatting

George J

Registered User.
Local time
Today, 18:28
Joined
Dec 4, 2011
Messages
51
I am trying to make sure that my double will have a comma for thousands, but will also be able to display more than 2 decimal places (probably 4).

I am struggling with what format to use - if the number doesn't have any decimal places, the point is still put in.
#,##0.####

Can anyone advise what I should be doing here?

examples:
23.2 = 23.2
64587.255 = 64,587.255
5000 = 5,000.
 
Try setting your format to Standard and your decimal to 4 in your table.

Dale
 
My advice: As rzw0wr said but set decimals to AUTO.
 
Mihail, Setting the decimal to auto will give you 2 decimal places, will it not.

Dale
 
You will conduct me to despair, Dale. Again you are right :) .

This code seems to do the trick on a Form:
Code:
Private Sub Form_Open(Cancel As Integer)
Dim strFormat As String
    strFormat = IIf(Int(Me.DoubleTypeField) = Me.DoubleTypeField, "#,###", "#,###.####")
End Sub
where the DoubleTypeField is the name for a text box.

I don't try for a report but I'm pretty sure that should be the same.
 
Thanks guys - i'll give them a try at work tomorrow
 

Users who are viewing this thread

Back
Top Bottom