T
tim
I'll start by saying that I've only been working with Access for the last several weeks, so I may be overlooking something simple
My problem is that I can't seem to create a table using VBA (even though I followed an example program
Can Anyone help me figure out what's going on?
Thanks in advance,Ti
I tried creating a table/ and even deleting a table using VBA, but I can't seem to get the example code to work. I encountered the issue that required that I enable the DAO library, so that's no longer the issue, but I'm still getting an error '3265' every time I run the code. Since I couldn't get the table to create, I thought that I would try to delete a table to test whether the table was even being seen. Apparently, the code doesn't get that far, before it craps out
The example code that I tried for the delete was
Dim db As DAO.Databas
Set db = CurrentD
db.TableDefs.Delete "testtable" 'The error occurs her
I tried this for the create table: (the code ran, but nothing happened) I tried this both with and without the DAO.
Dim db As DAO.Database
Dim td As DAO.TableDe
Dim fld As DAO.Fiel
Dim prp As DAO.Propert
Dim idx As DAO.Inde
Set db = CurrentD
' Create a new TableDef object
Set td = db.CreateTableDef("temptable"
Set fld = td.CreateField("test1", DB_INTEGER, 5
td.Fields.Append fl
Set fld = td.CreateField("test2", DB_TEXT, 5
td.Fields.Append fl
'set primary ke
Set idx = td.createindex("PrimaryKey"
Set fld = idx.CreateField("indexfield"
idx.primary = Tru
idx.unique = Tru
idx.Fields.Append fl
'add index to the indexes collectio
td.indexes.Append id
My problem is that I can't seem to create a table using VBA (even though I followed an example program
Can Anyone help me figure out what's going on?
Thanks in advance,Ti
I tried creating a table/ and even deleting a table using VBA, but I can't seem to get the example code to work. I encountered the issue that required that I enable the DAO library, so that's no longer the issue, but I'm still getting an error '3265' every time I run the code. Since I couldn't get the table to create, I thought that I would try to delete a table to test whether the table was even being seen. Apparently, the code doesn't get that far, before it craps out
The example code that I tried for the delete was
Dim db As DAO.Databas
Set db = CurrentD
db.TableDefs.Delete "testtable" 'The error occurs her
I tried this for the create table: (the code ran, but nothing happened) I tried this both with and without the DAO.
Dim db As DAO.Database
Dim td As DAO.TableDe
Dim fld As DAO.Fiel
Dim prp As DAO.Propert
Dim idx As DAO.Inde
Set db = CurrentD
' Create a new TableDef object
Set td = db.CreateTableDef("temptable"
Set fld = td.CreateField("test1", DB_INTEGER, 5
td.Fields.Append fl
Set fld = td.CreateField("test2", DB_TEXT, 5
td.Fields.Append fl
'set primary ke
Set idx = td.createindex("PrimaryKey"
Set fld = idx.CreateField("indexfield"
idx.primary = Tru
idx.unique = Tru
idx.Fields.Append fl
'add index to the indexes collectio
td.indexes.Append id