将Form RecordSource属性设置为外部数据库表 [英] Set Form RecordSource Property to Table of External Database

查看:345
本文介绍了将Form RecordSource属性设置为外部数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个MS ACCESS VBA应用程序,其中包含一个* .accdb文件中的代码,数据本身位于单独的* .accdb文件中。


我正在尝试将SplitForm的RecordSource属性设置为外部数据库中表(Table1)的所有元素,但不知道如何正确表达组合< DBname>。< TableName>对于那个功能。


下面的代码不起作用,但差不多了

I am trying to write an MS ACCESS VBA application that has the code in one *.accdb file and the data itself in a separate *.accdb file.

I am trying to set the RecordSource property of a SplitForm to all the elements of a table (Table1) in the external database, but don''t know how to properly express the combination <DBname>.<TableName> for that function.

The following Code does NOT work, but almost does

展开 | 选择 | 换行 | 行号

推荐答案

标准方法是使用链接表,尽管我确信可以按照您概述的方式使用查询。但在使问题复杂化之前,我想确保你有充分的理由不使用链表?


链接表的功能与访问中的普通表非常相似。您可以直接从前端打开它们并操纵它们。唯一的区别是它们位于你的后端。
The standard approach would be to use a linked table, allthough I do believe its possible to use a query in the way you have outlined. But before complicating matters I would like to make sure that you have a good reason to not use a linked table?

Linked tables function pretty much like normal tables in access. You can open them directly from your frontend, and manipulate them. The only difference is that they are located in your backend instead.


我对错误信息的理解是系统不认为Table1存在......而且它没有''在包含VBA代码的* .accdb中...当我设置Form.RecordSource属性时,我需要的是一种表达类似于... ExternalDBname.Table1的方法。你知道它的语法是什么吗?

TGlagowski
My understanding of the error message is that the system doesn''t think that Table1 exists... and it doesn''t within the *.accdb that contains the VBA code... What I need is a way to express something like... ExternalDBname.Table1 when I set the Form.RecordSource property. Do you know what the syntax would be for this?
TGlagowski


尝试使用查询设计视图界面创建查询。

我相信你不能因为你不能将 Table1 添加到设计窗口中。并且你不能这样做,因为(你几乎是正确的)系统知道这不是一个名为 Table1 的表。


因此,正如Smiley在第2篇文章中教你的那样,将Table1链接到当前数据库。一旦你这样做,一切都会好的。

如果你不知道如何通知我们你使用的Access版本,有人会教你。
Try to create the query using the Query design view interface.
I am sure that you can''t because you can''t add Table1 to the design window. And you can''t do that because (you are almost right) the system know that is not a table named Table1.

So, as Smiley teach you in post #2, link the Table1 to the current database. After you do that all will be Ok.
If you don''t know how to inform us about Access version you use and someone will teach you.


这篇关于将Form RecordSource属性设置为外部数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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