ms access - How do you overwrite a table created in VBA? -
i'm creating table in vba within loop , when run code table created. next time run it, error comes telling me table exists , remainder of code not executed. how can have overwrite existing table (from previous run)?
here code:
option compare database public function createtables() dim db dao.database dim tdf dao.tabledef dim rst dao.recordset dim fld dao.field dim strsql string strsql = "select skus skus" set db = currentdb() set rst = db.openrecordset(strsql) set fld = rst.fields("skus") 'msgbox fld.value rst.movefirst while not rst.eof set tdf = db.createtabledef(fld.value) set fld = tdf.createfield("skus", dbtext, 30) tdf.fields.append fld set fld = tdf.createfield("count", dbinteger) tdf.fields.append fld db.tabledefs.append tdf rst.movenext loop end function
can me out please? thanks!
i delete table before attempting recreate it:
db.tabledefs.delete fld.value
Comments
Post a Comment