Defaults and nulls

L

Lostguy

Hello!

Quick question about defaults and nulls:

From what I have gathered, if you have an autonumber primary key, the
foreign key that relates to that should be formatted as a number (long
integer) with a default value of null.

So I started wondering if there were any other defaults that I should
change in setup, or just leave their default blank.

I have an employee database with fields like hired date, birthdate,
date completed CPR training, etc.

Should the default for those fields be Null, or just left blank?

Any other changing defaults or nuggets I should check when setting up
my database?

Thanks for all your help!

VR/

Lost
 
D

Dirk Goldgar

Lostguy said:
Hello!

Quick question about defaults and nulls:

From what I have gathered, if you have an autonumber primary key, the
foreign key that relates to that should be formatted as a number (long
integer) with a default value of null.

Just leaving the Default Value property blank is the same as Null (except
for Yes/No fields, which can't store Null at all). You don't need to
actually specify Null as the default value. But you should, for a foreign
key, clear out the 0 that Access may assume as the default value.
So I started wondering if there were any other defaults that I should
change in setup, or just leave their default blank.

I have an employee database with fields like hired date, birthdate,
date completed CPR training, etc.

Should the default for those fields be Null, or just left blank?

I would leave them all blank, which is the same as Null. No default value =
no value put in the field unless you edit it = Null.
Any other changing defaults or nuggets I should check when setting up
my database?

I usually set all text and memo fields not to allow zero length strings.
There are only a very few cases where I want to make a distinction between a
zero-length string and Null, and I like to be able to test for Null alone,
rather than either Null or "". Your usage may vary, though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top