Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms Access 2010-无法编辑由记录集填充的未绑定表单中的文本框_Forms_Textbox_Edit_Recordset - Fatal编程技术网

Forms Access 2010-无法编辑由记录集填充的未绑定表单中的文本框

Forms Access 2010-无法编辑由记录集填充的未绑定表单中的文本框,forms,textbox,edit,recordset,Forms,Textbox,Edit,Recordset,我正在使用Access 2010和SQL Server 2008中的链接表。我有一个使用记录集填充的表单,该表单中文本框的控制源设置为记录集中的字段。我发现,尽管我可以浏览表单上的所有16条记录,并且表单加载正确,但我无法编辑Notes文本框。它需要是可编辑的。文本框已启用=True且已锁定=False。窗体的AllowEdits属性设置为true。查询中的所有表都有主键。那么,这是我的查询吗?因为它有右连接和内部连接?所以问题是我不能在文本框中输入 只是一点背景知识,我尝试使用一个查询作为此表

我正在使用Access 2010和SQL Server 2008中的链接表。我有一个使用记录集填充的表单,该表单中文本框的控制源设置为记录集中的字段。我发现,尽管我可以浏览表单上的所有16条记录,并且表单加载正确,但我无法编辑Notes文本框。它需要是可编辑的。文本框已启用=True且已锁定=False。窗体的AllowEdits属性设置为true。查询中的所有表都有主键。那么,这是我的查询吗?因为它有右连接和内部连接?所以问题是我不能在文本框中输入

只是一点背景知识,我尝试使用一个查询作为此表单的记录源,但发现Access的自动保存功能将不完整的记录插入到我的结果表中,另外还有保存按钮事件完成的更新和插入。如果规避此问题的唯一方法是询问用户是否希望在每次导航时保存更改,那么这对最终用户来说太令人沮丧了。因此,我不得不使用一个未绑定的表单,其中我使用VBA使用ADO记录集来填充它

顺便说一句,我可以编辑DocID和DocumentType列,不能更改的是查询中的字段(QCNote)

这是我的Form_Open事件的代码。我还有一个Form_Current事件,它禁用不适用类别的Submit按钮

Private Sub Form_Open(Cancel As Integer)

Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset 

Set cn = CurrentProject.AccessConnection
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn

DocID = [Forms]![QCDocAttributes]![DocID]

DocumentType = [Forms]![QCDocAttributes]![Document Type]

strSQL = "SELECT " & DocID & " AS DocID,'" & DocumentType & "' AS DocumentType,     QC_QCDecisionPoint.Description, QC_QCDecisionPoint.QCDecisionPointID , QC_QCResultDecisionPoint.QCNote FROM QC_QCResultDecisionPoint RIGHT JOIN ((QC_QCAttribute INNER JOIN QC_QCAttributeDecisionPointAsc ON QC_QCAttribute.QCAttributeID = QC_QCAttributeDecisionPointAsc.QCAttributeID) INNER JOIN QC_QCDecisionPoint ON QC_QCAttributeDecisionPointAsc.QCDecisionPointID = QC_QCDecisionPoint.QCDecisionPointID) ON QC_QCResultDecisionPoint.QCDecisionPointID = QC_QCDecisionPoint.QCDecisionPointID WHERE (((QC_QCAttribute.Description)= '" & [Forms]![QCDocAttributes]![AttributesDropdown] & "' ));"

.Source = strSQL
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.Open
End With
Set Me.Recordset = rs

Set rs = Nothing
Set cn = Nothing

End Sub