Link to home
Start Free TrialLog in
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

How replace empty number field with a "0.00"

On a form field I have a number field.  It the user clears the value in the field I want to replace it with a 0.00.

I've tried this but it doesn't work: (the field name is "1000"

=IIf([1000]="",0,[1000])
Avatar of Guru Ji
Guru Ji
Flag of Canada image

you can try this

IIf(Nz(1000.value) = vbNullString,0,[1000])
Avatar of clarkscott
If this is a numeric field...it will not = "".
iif(isnull([1000]),0,[1000])

scott c
Plus... you can forma a 0 to look like 0.00  ... but 0.00 is not a legitimate number.
1.0 = 1
1.1 = 1.1

0.00 = 0

etc.

scott C
Avatar of SteveL13

ASKER

IIf(Nz(1000.value) = vbNullString,0,[1000])  did not work.
This should do for the value in _another_ field than [1000]:

=Nz([1000],0)

/gustav
If you only have this field, use this in the AfterUpdate event:

  If IsNull(Me![1000].Value) Then
    Me![1000].Value = 0
  End If

/gustav
=Nz([1000],0)  did not work.

  If IsNull(Me![1000].Value) Then
    Me![1000].Value = 0
  End If

did work but I have 45 fields to code.
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial