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.
Apr 20 2012, 05:07 AM
If your form is Continuous or Single Form, you can put this in the Current Event of the form:
Private Sub Form_Current() If Val("" & Me.yourControlName) = 0 Then Me.yourControlName.Format = "" Else Me.yourControlName.Format = "#,###;(#,###)" End If End Sub
Apr 20 2012, 06:19 AM
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
Apr 20 2012, 06:34 AM
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):
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
Apr 20 2012, 08:04 AM
You can hide the actual textbox and capture the result into an unbound textbox something like this:
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.