dbTalk Databases Forums  

Add Index = Error 3058

comp.databases.ms-access comp.databases.ms-access


Discuss Add Index = Error 3058 in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Phil
 
Posts: n/a

Default Add Index = Error 3058 - 09-11-2010 , 09:10 AM






I am trying to add a Field FieldName = "MemAddID" to a table

With MyTblDef
Set MyField = .CreateField(FieldName, dbLong)
MyField.Required = True
MyField.OrdinalPosition = 0
..Fields.Append s.Append MyField ' Add Field "MemAddID" at top of table OK

Set MyIndex = .CreateIndex(FieldName)
Set MyField = MyIndex.CreateField(FieldName)
MyIndex.Required = True
MyIndex.Unique = True
'MyIndex.Fields.Append MyField
MyIndex.Fields.Append MyIndex.CreateField(FieldName)
.Indexes.Append MyIndex 'ERROR
End With

The field is added, but not the index. I get Error 3058 "Index or primary key
cannot contain a Null value" There are no indexes in the table

What am I doing wrong

Reply With Quote
  #2  
Old   
Phil
 
Posts: n/a

Default Re: Add Index = Error 3058 - 09-11-2010 , 09:22 AM






On 11/09/2010 15:10:04, "Phil" wrote:
Quote:
I am trying to add a Field FieldName = "MemAddID" to a table

With MyTblDef
Set MyField = .CreateField(FieldName, dbLong)
MyField.Required = True
MyField.OrdinalPosition = 0
.Fields.Append s.Append MyField ' Add Field "MemAddID" at top of table OK

Set MyIndex = .CreateIndex(FieldName)
Set MyField = MyIndex.CreateField(FieldName)
MyIndex.Required = True
MyIndex.Unique = True
'MyIndex.Fields.Append MyField
MyIndex.Fields.Append MyIndex.CreateField(FieldName)
.Indexes.Append MyIndex 'ERROR
End With

The field is added, but not the index. I get Error 3058 "Index or primary
key cannot contain a Null value" There are no indexes in the table

What am I doing wrong
Ignore me
MyIndex.Required = True should be MyIndex.Required = False

Works a treat now

Phil

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.