Run Time Error 91 -



I am trying to create a table using a module because the database will
only exist for it to process. It appears that the syntax is coded
correctly but I keep getting an error: Object Variable or With block
not set. I don't want to use the with block because I need to
eventually do late binding.

Any suggestion are appreciated.

Dim dbs As Database
Dim tdf As TableDef

Set tdf = dbs.CreateTableDef("tbl_RiskMK")
tdf.Fields.Append tdf.CreateField("Region", dbText)
tdf.Fields.Append tdf.CreateField("Sector", dbText)
tdf.Fields.Append tdf.CreateField("Business", dbText)
tdf.Fields.Append tdf.CreateField("EventCategory", dbText)
tdf.Fields.Append tdf.CreateField("Qtr_Yr", dbText)
tdf.Fields.Append tdf.CreateField("NetAmount_USD", dbDouble)
tdf.Fields.Append tdf.CreateField("EventRank", dbByte)
tdf.Fields.Append tdf.CreateField("BusinessRank", dbByte)
dbs.TableDefs.Append tdf

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question