Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

save new Access table

Status
Not open for further replies.

ELPorter

Programmer
Sep 15, 2003
1
US
Looking to create new MSAccess db table , set fields, and save table.
 
Hi ELPorter,

To just create an empty table you can do it with SQL

Code:
DoCmd.RunSQL "CREATE TABLE NewTableName (F1 Double, F2 Text)"

Or some more long-winded VBA (which I think is correct) ..

Code:
Dim OldDatabase As DAO.DataBase
Dim NewTable As DAO.TableDef
Set OldDatabase = CurrentDb
Set NewTable = OldDatabase.CreateTableDef("NewTableName")
With NewTable
  .Fields.Append .CreateField("F1", dbDouble)
  .Fields.Append .CreateField("F2", dbText, 255)
End With
OldDatabase.TableDEFS.Append NewTable

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top