How can i replace all the "0" in the field into "- "
Thanks
How can i replace all the "0" in the field into "- "
Thanks
Replace function.
Should we presume this is a text type field?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
update query
the field is a numeric field, i tried Replace but not allow
Of course, it's a number field. Exactly what are you trying to accomplish? Why do you want a "-" in place of 0?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Because, i have to use the data to print a voucher and it is nice to show - "-"rather than "0"
Perhaps the voucher could use something similar to
Replace (cstr(fieldname),0,-)
As its source?
But that will replace 0 in 103 with hyphen character.
In query or textbox:
IIf([fieldname]=0, "-", [fieldname])
However, won't be able to use number format settings in textbox.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks June. Just realised I misunderstood the problem.
you can use the format property for a control. Numbers can have different formats for positive, negative, zero and null. So in your case you could use. The format property does not affect the underlying value. The format function does.
#;#;"-";[Red]"You must enter a number"
Nice, I had forgotten this feature of number Format property. However, had to make a slight change:
#;-#;-;[Red]
If you prefer parens for negative:
#;(#);-;[Red]
To show + sign for positive:
+#;-#;-;[Red]
And [Red] just displays numbers entered into Null field as red as you type but once entered go black.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.