我可以使用哪些代码删除现有表并运行创建表查询? [英] What code can I use to delete an existing table and run a creat table query?

查看:65
本文介绍了我可以使用哪些代码删除现有表并运行创建表查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前运行create table查询的代码如下...我需要先删除一个表(MM_CL)(如果存在),然后运行下面的create table查询创建一个新的MM_CL表并执行已填充数据的计数。有什么想法吗?

My current code to run the create table query is below...I need to first delete a table (MM_CL) if it exists, then run the create table query below which creates a new MM_CL table and does a count of the data populated. Any ideas?

Dim qdf3 As DAO.QueryDef

设置qdf3 = CurrentDb.Defs(" MM_Contract_Labor")

qdf3.Execute

Dim qdf3 As DAO.QueryDef
Set qdf3 = CurrentDb.Defs("MM_Contract_Labor")
qdf3.Execute

推荐答案

你可以使用

On Error Resume Next
CurrentDb.Execute "DROP TABLE [YourTableName]"




请参阅
MSDN:DROP语句


这篇关于我可以使用哪些代码删除现有表并运行创建表查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆