如何防止查询/表单成为只读 [英] How to prevent query/form from being read-only

查看:58
本文介绍了如何防止查询/表单成为只读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我创建了一个数据库,用于链接ODBC数据源中的一个表。我将我的密码和UID保存到数据源,所以我和其他任何人都不必每次登录(这只是奖金背景信息)。


我拿这张桌子,这是只读的,并运行一个APPEND查询,将表中的新项添加到我创建的另一个表中(有两个额外的字段,用户将通过表单更新)。我还使用UNMATCHED查询运行另一个APPEND查询,以帮助保持我的表与链接表一致。我有一个基于我的表的SELECT查询,我用作表单的记录源。


当我昨天更新表时,我注意到数据库的守护者我链接到已添加重复记录,我没有任何用处。所以,我进入并在我的SELECT查询中将DISTINCT添加到SQL中以删除重复项。当我这样做时,它导致窗体和SELECT查询变为只读。我做了一些研究,发现它是因为我使用了DISTINCT谓词。


我不在乎我的查询中是否有重复项,但我不知道我希望表单或报表中的用户可以看到重复项。有没有办法过滤掉这些重复项?如果没有,我需要找到一种方法从我的查询中删除重复项,以便表单不是只读的。

Hi everybody,

I created a database that links one table from an ODBC data source. I saved my password and UID to the data source so neither myself nor anyone else would have to login each time (that''s just bonus background info).

I take this table, which is read-only, and run an APPEND query that adds new items from the table into another table I created (that has two additional fields that will be updated by the user via a form). I also run another APPEND query with an UNMATCHED query to help keep my table in line with the linked table. I have a SELECT query that is based off of my table that I use as the record source for my form.

When I updated the table yesterday, I noticed that the keepers of the database that I linked to had added duplicate records that I don''t have any use for. So, I went in and added DISTINCT to the SQL in my SELECT query to remove the duplicates. When I did this, it caused the form and the SELECT query to become read-only. I did some research and found that it''s because I used the DISTINCT predicate.

I don''t care if the duplicates are there in my query, but I don''t want the duplicates to be visible to the user in the form or the report. Is there a way to filter out these duplicates? If not, I need to find a way to remove the duplicates from my query so that the form won''t be read-only.

展开 | 选择 | Wrap | 行号

推荐答案

从我所知道的,你将不得不从你的表中删除重复的记录。这不能解决问题吗?
From what I can tell, you are going to have to remove duplicate records from YOUR table. Wouldn''t that solve the problem?


你不能解释复制在这种情况下的含义。


是重复密钥还是完整重复记录?

当源中有重复项时,有没有办法确定选择哪条记录?


如果没有这些信息,就很难继续下去。


您可以在上面提出的附加方法之后采取删除,但这可能没有必要,取决于我们不了解的情况。
You don''t explain what duplicate means in this context.

Is it a duplicate key or a full duplicate record?
Is there any way of determining which record to select when there are duplicates in the source?

Without this info it''s hard to proceed.

You can certainly take the remove after append approach suggested above, but this may not be necessary, depending on aspects of the situation we have no knowledge of.


让我看看我是否可以回答你的问题NeoPa。


在链接表上,我正在导入表格中的四个字段中的每一个 - 设施,用户角色,选项描述和DSS。但是,我只对User Role字段感兴趣,这是我追加时要检查的内容(请忽略此表中的命名约定,因为它们与我表中的命名约定冲突...当我说用户角色时链接表中的字段,我的意思是所有其他表/查询中的Option Name字段。


据我所知,链表没有主键。我的表有一个名为ID的主键作为自动编号。每个ID都与包含设施,用户角色,选项描述和链接表中的DSS的记录相关联。


因为我只对链接中的用户角色字段感兴趣表,对我来说,只要选择一个重复项中的哪个记录就没关系,只选择一个。


在我的表中,用户角色字段变为选项名称字段,我添加了选项描述和选项路径字段供用户填写。我想在我的原始帖子中我应该提到将用户角色/选项名称字段设置为只读是可以的,因为我想要它与链接表一致,但剩下的两个表必须是读/写,否则数据库是无用的。


这对你有帮助吗?
Let me see if I can answer your questions NeoPa.

On the linked table, I''m importing each of the four fields in the table - Facility, User Role, Option Description, and DSS. However, I''m only interested in the User Role field, which is what is being checked when I append (Please disregard the naming conventions in this table because they conflict with the naming conventions in my table...when I say User Role field in the linked table, I mean the Option Name field in all other tables/queries).

As far as I can tell, there is no primary key for the linked table. My table does have a primary key called ID as autonumber. Each ID gets associated with a record containing Facility, User Role, Option Description, and DSS from the linked table.

Because I''m only interested in the User Role field in the linked table, it doesn''t matter to me which record out of the duplicates is selected as long as one, and only one are selected.

In my table, the User Role field becomes the Option Name field, and I added the Option Description and Option Path fields for the user to fill in. I guess in my original post I should have mentioned that having the User Role/Option Name field be read-only is okay because I want it to be consistent with the linked table, but the two remaining tables must be read/write, otherwise the database is useless.

Does that help out any?


这篇关于如何防止查询/表单成为只读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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