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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|