Full Version: Do Not Show $0.00 In Form
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
foxtrojan
I used #,###;(#,###) decimal 2 in my Number format. If there is no value this 0.00 appears. How do you show a blank instead of 0.00.
The whole forms looks so over-populated with 0.00 all over. Please help.
arnelgp
If your form is Continuous or Single Form, you can put this in the Current Event of the form:
CODE
Private Sub Form_Current()
    If Val("" & Me.yourControlName) = 0 Then
        Me.yourControlName.Format = ""
    Else
        Me.yourControlName.Format = "#,###;(#,###)"
    End If
End Sub
foxtrojan
Thanks Arnelgp. Is it possible to have the code in the Control Format rather than the Current event?. Too many number controls in the form
arnelgp
Well I think we cannot do that.
If dont refer your control in code, you can rename them and use something like (assumming you rename it to txtAmt1 to txtAmt10):

CODE
Private Sub Form_Current()
    Dim oControl As Control
    Dim i as Integer
    For i = 1 To 10
        oControl  = Me.Controls("txtAmt" & i)
        If Val("" & oControl.Value) = 0 Then
            oControl.Format = ""
        Else
            oControl.Format = "#,###;(#,###)"
        End If
    Next
End Sub
dipetete
You can hide the actual textbox and capture the result into an unbound textbox something like this:
CODE
=IIf([Text0]=0,Null,Format([Text0],"Currency"))
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.