J said:
Ken,
Thanks, I'll have to get familiar with your solution as it would currently
be beyond my programming capability. I was hoping I could do it directly
from VBA if I couldn't use the macro capability.
J Austin
If you really need to skip using DDL, which is the easiest way as Ken
stated, you could use the fact that TableDef's have a CreateField method.
Something like:
Set tdf = MyDB.CreateTableDef("tblOutput")
Set fld = tdf.CreateField("Notes", dbText, 50)
tdf.Fields.Append fld
Set fld = tdf.CreateField("StreamID", dbLong)
tdf.Fields.Append fld
Set fld = tdf.CreateField("Diameter", dbDouble)
tdf.Fields.Append fld
tdf.Fields.Refresh
MyDB.TableDefs.Append tdf
MyDB.TableDefs.Refresh
Set tdf = Nothing
Set fld = Nothing
Also, TableDef's have a CreateIndex method and an Indexes collection so
even more than that can be done with VBA but using DDL is much more
elegant. I used CreateField in a post once simply to try something
different since creating an empty table with all the correct fields and
deleting all the records before use with a Delete Query worked
adequately when used in conjunction with MyDB.RecordsAffected.
James A. Fortune
[email protected]