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