带有动态 from 语句的 MS Access 查询 [英] MS Access query with dynamic from statements

查看:53
本文介绍了带有动态 from 语句的 MS Access 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这让我很烦恼.我在 from 子句中使用 in 语句创建了一个查询.我想要做的是让一个全局变量填充 from 语句.示例

Ok this is vexing me. I have a query I created with an in statement in the from clause. What I am looking to do is have a global variable populate that from statement. Example

Select *
Form query1 in <Global Variable filename>

发生了什么是我链接到一个文件,其中包含数百个链接表和查询.我的数据库只有几个选择查询和链接表到不同的数据库.我不想重新构建所有查询,链接表是我的数据库.问题是包含所有链接的文件每月更改一次名称.我只想读取一个包含数据库当前名称的文本文件,这样每次数据库名称更改时我都不必更改查询.这也需要查询,因为我有其他使用外部链接查询的查询.

What is going on is I link to a file that has hundreds of linked table and queries in it. My database only has a few select queries and link table to different database. I did not want to re-build all the queries and linked table is my database. The issue is the file with all the links changes name once a month. I just want to read a text file with the current name of the database in it so I do not have to keep changing my queries every time the database name changes. Also this has to a query since I have other queries using the externally linked query.

推荐答案

另一种方法是每月只使用相同的文件名,这样您就无需在 Access 应用程序中进行任何更改.您可以轻松地编写代码,将文件复制到先前副本之上的标准名称(当然,您必须在复制之前将其删除),这将保留历史记录.

Another way to do this would be to just use the same file name each month so you wouldn't have to change anything in your Access app at all. You could easily code copying the file to the standard name over top of the previous copy (you'd have to delete it before copying, of course), which would retain the history.

这篇关于带有动态 from 语句的 MS Access 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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