How can I tell if data entered is null?

G

Guest

I have 4 tables. In each of them I am using a field called Membership No as
the primary key. In 3 tables it works just fine. But in one, whenever I try
to set the primary key, the message comes up "index or primary key cannot
contain a null value". The membership numbers are 8 figures long, starting
with 2 zeroes - eg 00123456. As I had already entered most of the numbers
before setting the primary key (as with the other tables) I even deleted the
figures and re-entered them. It drives me crazy when something works for one
table and yet won´t work for another! I´m using Office 2003. Help!
 
D

Douglas J. Steele

I don't quite understand what you're doing.

Are you saying that there's already data in the table, you're trying to
create a PK and you get that message? If so, write a query that has IS NULL
as the criteria under each of the fields you're trying to put in the PK.

If something else, post back.
 
C

CyberTaz

Hi Sheila-

That message along with your statement "I had already entered *most* of the
numbers" is a pretty good indication that you are trying to define as PK a
field where at least one existing record has no data. If there are a lot of
records in the table, a query using the Is Null criteria is your best bet.
If a small number of records, you may prefer to just examine the datasheet
and update the records there. Until each record contains a unique entry in
that field, it cannot be defined as PK.

LOL |:>)


On 3/20/05 6:05 AM, in article
I have 4 tables. In each of them I am using a field called Membership No as
the primary key. In 3 tables it works just fine. But in one, whenever I try
to set the primary key, the message comes up "index or primary key cannot
contain a null value". The membership numbers are 8 figures long, starting
with 2 zeroes - eg 00123456. As I had already entered most of the numbers
before setting the primary key (as with the other tables) I even deleted the
figures and re-entered them. It drives me crazy when something works for one
table and yet won´t work for another! I´m using Office 2003. Help!

-- (e-mail address removed)
 

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

Top