Error Message "Index or Primary Key cannot contain a null value"

Z

ZZBC

I am using Access 2000 and XP and attempting to append a record in VB6.
The statement:
Adodc1.Recordset.Update
is giving me an error message:
Index or Primary Key cannot contain a null value
I had originally initially had one indexed field "RecNO" but changed it
to a non indexed database in an effort to troubleshoot my code.
I am still getting the error message.
Suggestions Please?
 
J

John W. Vinson

I am using Access 2000 and XP and attempting to append a record in VB6.
The statement:
Adodc1.Recordset.Update
is giving me an error message:
Index or Primary Key cannot contain a null value
I had originally initially had one indexed field "RecNO" but changed it
to a non indexed database in an effort to troubleshoot my code.
I am still getting the error message.
Suggestions Please?

Open your table in design view. Does any field have a key icon to the left of
it?

If so, that field is the Primary Key. It cannot contain a null value. Your VB
code is (I presume) putting data into some fields in the recordset... but not
this one.

It's not at all clear to me what you mean by a "non indexed database". How did
your remove the indexes from the table? You are aware, I hope, that setting a
Primary Key automatically creates a unique index on that field, independent of
the Indexes toolbar window?

John W. Vinson [MVP]
 
Z

ZZBC

Thanks for taking the time to respond!

I need to mull over your comments ...

Sorry I use the wrong terminology! ... by non indexed I meant that
under the General Tab in the design mode of the Access file; I change
the 'indexed' to NO.

There are no key icons ... I am using a unique (sequential integer) in a
RECNO field to identify the records.
 
J

John W. Vinson

Sorry I use the wrong terminology! ... by non indexed I meant that
under the General Tab in the design mode of the Access file; I change
the 'indexed' to NO.

I've never seen an "indexed" property for an Access database, and looking at
Tools... Options... General in A2003 there still isn't one. And it makes no
sense whatsoever to talk about a Database being indexed or not indexed - a
Database is a container for multiple tables, forms, reports and other objects.

What version of Access are you using? Where do you get to "design mode of the
Access file"?
There are no key icons ... I am using a unique (sequential integer) in a
RECNO field to identify the records.

How? What steps did you take to make this RECNO unique and sequential?

John W. Vinson [MVP]
 
G

George Nicholson

attempting to append a record in VB6

sounds like he might not be using the Access interface at all, but
manipulating a mdb file externally via VB6 tools or some other rde..
 
Z

ZZBC

Again my poor use of terminology was misleading ... SORRY!
MR Nicholson is correct ... I was going out of VB to change the basic
file structure using Access 2000 ... sorry!

Meanwhile, you were correct in your first suggestion ... I was leaving
the RECNO field blank!

Sorry this has taken so much of your time, but please be aware that
through all of my poor explanations, that you helped me fix what was
broke! THANKS!
 
J

John W. Vinson

you helped me fix what was
broke! THANKS!

You're welcome - glad that the fog cleared in time to come in for a safe
landing! <g>

John W. Vinson [MVP]
 

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