A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old August 22nd, 2007, 02:59 AM posted to microsoft.public.access.tablesdbdesign
ZZBC
external usenet poster
 
Posts: 4
Default Error Message "Index or Primary Key cannot contain a null value"

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?
  #2  
Old August 22nd, 2007, 04:11 AM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Error Message "Index or Primary Key cannot contain a null value"

On Tue, 21 Aug 2007 21:59:48 -0400, ZZBC
wrote:

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]
  #3  
Old August 22nd, 2007, 04:52 AM posted to microsoft.public.access.tablesdbdesign
ZZBC
external usenet poster
 
Posts: 4
Default Error Message "Index or Primary Key cannot contain a null value"

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.

John W. Vinson wrote:
On Tue, 21 Aug 2007 21:59:48 -0400, ZZBC
wrote:

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]

  #4  
Old August 22nd, 2007, 05:24 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Error Message "Index or Primary Key cannot contain a null value"

On Tue, 21 Aug 2007 23:52:34 -0400, ZZBC
wrote:

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]
  #5  
Old August 22nd, 2007, 06:16 PM posted to microsoft.public.access.tablesdbdesign
George Nicholson
external usenet poster
 
Posts: 791
Default Error Message "Index or Primary Key cannot contain a null value"

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..




"John W. Vinson" wrote in message
...
On Tue, 21 Aug 2007 23:52:34 -0400, ZZBC
wrote:

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]



  #6  
Old August 22nd, 2007, 06:50 PM posted to microsoft.public.access.tablesdbdesign
ZZBC
external usenet poster
 
Posts: 4
Default Error Message "Index or Primary Key cannot contain a null value"

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!

John W. Vinson wrote:
On Tue, 21 Aug 2007 23:52:34 -0400, ZZBC
wrote:

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]

  #7  
Old August 22nd, 2007, 08:23 PM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Error Message "Index or Primary Key cannot contain a null value"

On Wed, 22 Aug 2007 13:50:14 -0400, ZZBC
wrote:

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]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:43 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.