Z
Zlatko Matiæ
Hello.
How to programaticcaly create a table from a recordset ?
I tried something like this:
qryrs is recordset created by a querydef (pass-through query)...
Set tbl = db.CreateTableDef("TableNAme")
For I = 0 To qryrs.Fields.Count - 1
FieldName = qryrs.Fields(I).Name
FieldType = qryrs.Fields(I).Type
FieldSize = qryrs.Fields(I).Size
Set fld = tbl.CreateField(FieldName, FieldType, FieldSize)
' Append field to Fields collection
tbl.Fields.Append fld
Next I
' Append table to TableDef collection
db.TableDefs.Append tbl
But I have an error concerning data type of FieldType....
What is wrong ?
How to programaticcaly create a table from a recordset ?
I tried something like this:
qryrs is recordset created by a querydef (pass-through query)...
Set tbl = db.CreateTableDef("TableNAme")
For I = 0 To qryrs.Fields.Count - 1
FieldName = qryrs.Fields(I).Name
FieldType = qryrs.Fields(I).Type
FieldSize = qryrs.Fields(I).Size
Set fld = tbl.CreateField(FieldName, FieldType, FieldSize)
' Append field to Fields collection
tbl.Fields.Append fld
Next I
' Append table to TableDef collection
db.TableDefs.Append tbl
But I have an error concerning data type of FieldType....
What is wrong ?