I'd like to create a table using the folowing subprocedure:
-----
Sub CreateTable()
Dim dbs As Database, tbl As TableDef, fld As Field
Set dbs = CurrentDb
Set tbl = dbs.CreateTableDef("Test")
Set fld = tbl.CreateField("test1", dbText)
tbl.Fields.Append fld
dbs.TableDefs.Append tbl
dbs.TableDefs.Refresh
End Sub
----
I typed the above vba in a module. But, How can I run this subprocedure?
After searching for an answer, I understand I need a function procedure to run a sub procedure. So I made the folowing procedure:
-----
Public Function MakeTable() As Boolean
CreateTable()
End Function
-----
However, Acces gives me a fault on this the "CreatTable()" appears in red. Can someone help me how to run the above sub procedure?
Thanks a lot!
Leen (beginner..)
-----
Sub CreateTable()
Dim dbs As Database, tbl As TableDef, fld As Field
Set dbs = CurrentDb
Set tbl = dbs.CreateTableDef("Test")
Set fld = tbl.CreateField("test1", dbText)
tbl.Fields.Append fld
dbs.TableDefs.Append tbl
dbs.TableDefs.Refresh
End Sub
----
I typed the above vba in a module. But, How can I run this subprocedure?
After searching for an answer, I understand I need a function procedure to run a sub procedure. So I made the folowing procedure:
-----
Public Function MakeTable() As Boolean
CreateTable()
End Function
-----
However, Acces gives me a fault on this the "CreatTable()" appears in red. Can someone help me how to run the above sub procedure?
Thanks a lot!
Leen (beginner..)