Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Zero Edit Function 1

Status
Not open for further replies.

bdavis96

Programmer
Feb 11, 2002
97
US
Is there a function like Trim or whatever that removes zeros?

Example:

TestVar= 0 - Comes in from Database
TextBox = TextFunction(TestVar)

When you see the TextBox on the form, it just shows blank (not containing anything).

Any help would be much appreciated.


 
you mean remove leading zeros or zeros in the least significant digits after the decimal in a string format? or just test for zero and change it to a blank?

for your simplistic case, the simplest thing is:

TextBox = iif(TestVar = 0, "", TestVar)

you can get more elaborate using iif(), Replace(), Format(), CStr(), CInt()/CSng()/CDbl() and I'm sure there's many more functions that you can throw together to do whatever you'd like.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top