B
BSK
I am trying to get this code to work. IT is supposed to create a
table when a button is clicked. This code is not working. When I
attempt it, access gives me the error "Runtime Error 3219: Invalid
Operation" This occurs at the line that says
'db.tabledefs.append(tbdf)' Any ideas?
Dim tbdf As DAO.TableDef
Dim db As DAO.Database
Dim fld As DAO.Field
Set db = CurrentDb
Set tbdf = db.CreateTableDef(strFilename)
tbdf.Fields.Append (tbdf.CreateField("Drawing"))
db.TableDefs.Append (tbdf)
'refresh the table collection
db.TableDefs.Refresh
'refresh the database window
RefreshDatabaseWindow
Set tbdf = Nothing
table when a button is clicked. This code is not working. When I
attempt it, access gives me the error "Runtime Error 3219: Invalid
Operation" This occurs at the line that says
'db.tabledefs.append(tbdf)' Any ideas?
Dim tbdf As DAO.TableDef
Dim db As DAO.Database
Dim fld As DAO.Field
Set db = CurrentDb
Set tbdf = db.CreateTableDef(strFilename)
tbdf.Fields.Append (tbdf.CreateField("Drawing"))
db.TableDefs.Append (tbdf)
'refresh the table collection
db.TableDefs.Refresh
'refresh the database window
RefreshDatabaseWindow
Set tbdf = Nothing