Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error on creat table with dbAutoIncrField

Status
Not open for further replies.

100bure

IS-IT--Management
Feb 11, 2002
12
CH
Hi

I tried to make a table with the following code. but i get an run-time error '13', type mismacht on the line "Set fldNew = .CreateField("NrGruppe", dbLong)".
any idea why?

Dim dbs As Database
Dim tdfNew As TableDef
Dim idxNew As Index
Dim fldNew As Field
Dim prpLoop As Property

Set dbs = CurrentDb

' Create a new TableDef object.
Set tdfNew = dbs.CreateTableDef("PLAN_GRUPPE")
With tdfNew
Set fldNew = .CreateField("NrGruppe", dbLong)
fldNew.Attributes = dbAutoIncrField
.Fields.Append fldNew
.Fields.Append .CreateField("ProduktBez", dbText)
.Fields.Append .CreateField("Periode", dbLong)
.Fields.Append .CreateField("Prozent", dbDouble)
.Fields.Append .CreateField("GrSumme", dbLong)
Set idxNew = .CreateIndex("NumIndex")
idxNew.Fields.Append idxNew.CreateField("NrGruppe")
idxNew.Primary = True
.Indexes.Append idxNew
dbs.TableDefs.Append tdfNew
End With

close.dbs


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top