View Full Version : Dont' want Access to put 0 for Default Value


ions
11-05-2009, 06:17 PM
Dear Access Expert.

Can I change this setting to be empty? I can't find it in the table options. I am using Access 2003.

I want Access to always leave this blank.

Thanks

John Big Booty
11-05-2009, 06:24 PM
Sorry I'm not quite sure what you are looking for the thread title says Dont' want Access to put 0 for Default Value then you go on to say you don't want Access to always leave the field blank :confused:

In short you can put any value you like in the default value setting at table level.

ions
11-05-2009, 06:27 PM
Sorry,

I meant to say "I want Access to always leave this blank."

Banana
11-05-2009, 06:31 PM
In Access 2003 and earlier, they put 0 in default value by default. To prevent this, just delete the 0 from the default value and there will then be no default value at all. Note further that if the field is marked required there will be errors when attempting to save a record without inserting a value for that, which can be good or bad thing.

John Big Booty
11-05-2009, 06:33 PM
What he said ^^^^^^

ions
11-05-2009, 06:45 PM
So there is no option for this. I have to remember to manually delete it.

Banana
11-05-2009, 06:47 PM
Well, I suppose one could 1) use Access 2007 which gets the default right, or 2) bang out a little VBA script to loop through TableDefs collection and interrogating the Fields collection for any numeric data types and omitting the default values.

ions
11-05-2009, 06:49 PM
Ok. Thanks

gemma-the-husky
11-06-2009, 12:47 AM
its not really a question of manually deleting it - there are a number of options you need to think about when creating any field - access has generally useful defaults, but occasionally you may need to change them.

i would suggest that 0 is generally appropriate in 99% of cases. blank is certainly not as useful as 0 with numerics. if data may be blank then you need to be aware of the possibility of nulls throught your program and allow for them. its much better to not have nulls with numerics. if your number must always be positiove, just use -1 say, as a the default to indicate "emptyness"

ions
11-06-2009, 04:53 AM
I find if you have many numerical controls on a form it is easier for the user to scan which have been filled when non-filled controls contain NULL.

Also if the Default is 0 and the actual value can be 0 you cannot know if the user entered this value or the system.

I want to remove the 0 primarly for the user interface not for development purposes.

Thanks gemma

gemma-the-husky
11-06-2009, 05:21 AM
it depends what the values are - its always a problem distinguishing an empty from a real nil value - one way is to force something to be entered, and actually provide a mechanism to include an "o/s" or a "n/a" - cant really do this with numerics though.