尝试从表单时,Recordset不可更新,但如果只加载子表单,则工作正常

时间:2016-03-08 20:56:07

标签: ms-access access-vba

我有一个带有数据表子表单的表单。当我尝试加载主窗体并更新子窗体中的某些字段时,它会给出错误:(Recordset不可更新)

但是当我自己加载子表单时它工作正常。我使用Access 2007。

其中一个文件下的代码是:

# image lines
#-hugin  cropFactor=1
i w3400 h4000 f0 v1.99999941916805 Ra0 Rb0 Rc0 Rd0 Re0 Eev0 Er1 Eb1 r0.00641705670350258 p0.588362807000514 y-0.252729475162748 TrX0 TrY0 TrZ0 j0 a0 b0 c0 d0 e0 g0 t0 Va1 Vb0 Vc0 Vd0 Vx0 Vy0  Vm5 n"SQNrnTw.png"

当我从以下位置更改源记录源时,问题就出现了:

Private Sub No_open_quality_issues_Click()
If (Me.No_open_quality_issues.Value = True) Then
    Me.No_open_quality_issues.Locked = True
End If
End Sub

致:

SELECT Production_Readiness.*
FROM Production_Readiness;

更具体地说,当我尝试在加载表单时使用此函数时会发生这种情况:

SELECT DISTINCT Production_Readiness.*
FROM Production_Readiness
WHERE (((Production_Readiness.Material) Like '' & "*" Or (Production_Readiness.Material) Is Null) AND ((Production_Readiness.[All Engine Models]) Like '' & "*" Or (Production_Readiness.[All Engine Models]) Is Null) AND ((Production_Readiness.Commodities) Like '' & "*" Or (Production_Readiness.Commodities) Is Null) AND ((Production_Readiness.[Buyer Name]) Like '' & "*" Or (Production_Readiness.[Buyer Name]) Is Null) AND ((Production_Readiness.Vendor) Like '' & "*" Or (Production_Readiness.Vendor) Is Null) AND ((Production_Readiness.[Vendor Name]) Like '' & "*" Or (Production_Readiness.[Vendor Name]) Is Null) AND ((Production_Readiness.[MinOfStat-Rel Del Date     Next coming delivery])>=#5/16/1892# And (Production_Readiness.[MinOfStat-Rel Del Date     Next coming delivery])<=#3/15/2016#) AND ((Production_Readiness.[Buyer Badge])=FctUserID()) AND ((Production_Readiness.Status)<>'Processed'));

结束功能

你能帮助我吗?

由于

1 个答案:

答案 0 :(得分:1)

我发现错误,实际上是逻辑错误。 DISTINCT中的问题。这就是为什么我无法更新,因为它是一个具有相同值的记录,并且访问没有线索要更新。