SQL Server连接到Access FrontEnd,“此Recordset不可更新”。

时间:2014-03-27 21:03:55

标签: sql-server ms-access odbc

所以我开始了一项新工作,继承了与几个访问前端相关的绝对残酷的数据库集合。在尝试创建测试服务器时,我遇到了前端问题。之前的开发人员创建了一些与SQL Server 2008 r2中的表和视图相关联的访问表单。我试图弄清楚为什么我无法编辑任何字段(文本,组合框,列表等)中的任何值。

表单所依赖的视图是:

AuditQueries_UserTableForSelectionForms

该视图类似于:

SELECT        TableForFormFields_1.FormSelectionID, TableForFormFields_1.JobPlan, TableForFormFields_1.Floor, TableForFormFields_1.Location, TableForFormFields_1.CHSR#, TableForFormFields_1.PanelName, 
                     TableForFormFields_1.PanelLetter, TableForFormFields_1.PanelCircuit, TableForFormFields_1.StartDate, TableForFormFields_1.EndDate, TableForFormFields_1.MigrationDate, TableForFormFields_1.JTag, 
                     TableForFormFields_1.MinBusRow, TableForFormFields_1.MaxBusRow, TableForFormFields_1.PlanID, TableForFormFields_1.Equip, TableForFormFields_1.CabinetJTag, 
                     Shared_Tables.dbo.username.[User]
FROM            Audit.TableForFormFields AS TableForFormFields_1 INNER JOIN
                     Shared_Tables.dbo.username ON TableForFormFields_1.FormSelectionID = Shared_Tables.dbo.username.[User]

TableFormFields是一个表,其中包含各种表单中所有字段的默认值,并根据登录用户进行更改。使用以下视图检测登录用户:

SELECT        CASE LEFT(SYSTEM_USER, 11) WHEN 'LIGHTHOUSE\' THEN SYSTEM_USER ELSE 'Webuser' END AS [User]

我用Google搜索了错误,我发现的所有文档似乎都不相关。数据库中的其他表单与表似乎有效的表绑定,如果我将表单的数据源更改为:

SELECT * FROM TableForFormFields AS TableForFormFields_1

一切都按要求运作。然而,这与生产环境不同,我需要保持它们相同,或者至少尽可能接近它们。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

由于JOIN,它们查询(因此由查询填充的记录集)不可更新。当您有联接时,表单或数据表或使用查询的任何内容都无法解决您的更改将会发生的位置。如果您希望记录集可更新,则需要引用一个表。

组合框/列表框等​​的ControlSource是告知数据保存记录时要写入的位置的属性。它是RecordSource形式的字段。

控件的RowSource属性告诉控件显示哪些可用选项。

在您的情况下,您应该将RowSource设置为提供相关数据的视图,并将ControlSource设置为表中将要更新的记录。

相关问题