I created a function in a module:
Public Function createTable()
Dim db As Database
Dim tdf As TableDef
Dim fld As Field
Set db = CurrentDb()
Set tdf = db.CreateTableDef("161-0363")
Set fld = tdf.CreateField("SKUS", dbText, 30)
tdf.Fields.Append fld
Set fld = tdf.CreateField("Count", dbInteger)
tdf.Fields.Append fld
End Function
Then called this function in a macro using “RunCode”. But no table is created when I run the macro?
Can anyone help me out?
Thanks!
On your Macro Design View, you should have it say
RunCode, then in yourFunction Nameit should saycreateTable()Does the code create a table if you run it without a macro?
EDIT:
Update your code to this then run your macro
I just tested the above code and it created the table. You needed to add the last lines of code to get it to work.