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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null values in numeric fields

Status
Not open for further replies.

RSfromCO

Programmer
May 3, 2002
149
US
I noticed that if I define a custom object that contains an integer and a double value, when the object is instantiated both of these values are set to 0 (rather than null). So when I populate a textbox on the form with these data items they display 0 rather than being blank.

The problem is that 0 is a number, so I can't tell if the user entered a 0 (zero), or didn't enter anything.

Hmmmmmm. The only way around this that I can think of is to make the values in my object VARIANT data types rather than Long and Double, which seems to me to open up another can of worms having the data type of the object not match the data type within the database. Is there a better way to allow the user to leave a numeric field blank and have NULL stored back into the database? Or is using Variant a common practice?
 
Or is using Variant a common practice
In VBA, only Variant may hold a Null ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top