MS Access-在VBA中按名称执行保存的查询 [英] MS Access - execute a saved query by name in VBA

查看:143
本文介绍了MS Access-在VBA中按名称执行保存的查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在VBA的MS Access 2007中执行保存的查询?

How do I execute a saved query in MS Access 2007 in VBA?

我不想将SQL复制并粘贴到VBA中.我宁愿执行查询的名称.

I do not want to copy and paste the SQL into VBA. I rather just execute the name of the query.

这不起作用... VBA找不到查询.

This doesn't work ... VBA can't find the query.

CurrentDb.Execute queryname

推荐答案

您可以通过以下方式进行操作:

You can do it the following way:

DoCmd.OpenQuery "yourQueryName", acViewNormal, acEdit

OR

CurrentDb.OpenRecordset("yourQueryName")

这篇关于MS Access-在VBA中按名称执行保存的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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