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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Table with Code

Status
Not open for further replies.

Vidar13

IS-IT--Management
Apr 4, 2001
90
US
I know how to delete a table in a macro, but how would you do it with code?

I would assume you would use
"DoCmd.RunCommand acCmdDelete", but how would this be syntaxed to kill a table?
 
dim sql as string

sql = "DROP Table {table name};"

DoCmd.RunSQL sql

you could also do this

DoCmd.RunSQL "DROP Table {table name};"

if your table name is going to be a user input then

"DROP Table " & {user input table name} & ";"

HTH
 
You could try,
Private Sub Command36_Click()
DoCmd.DeleteObject acTable, "TableName"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top