我收到错误“运行时错误2105访问你不能去指定的记录”?请帮我

时间:2010-06-28 12:04:14

标签: ms-access vba access-vba

 Private Sub cmd_New_Click()
    Dim Response%
    If Me.Dirty Then
        Response = MsgBox("Save changes to the job record?", vbYesNoCancel, scAppTitle)
        Select Case Response
        Case vbYes
            SendKeys "+{Enter}"
        Case vbNo
            Me.Undo
        Case vbCancel
            Exit Sub
        End Select
    End If

    cbo_SourceID.Requery


    DoCmd.GoToRecord acDataForm, Me.Name, acNewRec


    DoCmd.GoToControl CtlName(Me, 0)

End Sub

来自以下评论的记录集

SELECT tbl_Jobs.*,
 tbl_JobLocations.*,
 tbl_Invoices.*,
 tbl_Clients.client_ClientNumber,
 tbl_Clients.client_PrimaryContactID,
 tbl_Clients.client_Name,
 tbl_Clients.client_Address,
 tbl_Clients.client_Phone,
 [jobl_KeymapPage] & [jobl_KeymapGrid] AS qcalc_KMC,
 [client_City] & " " & [client_State] & " " &  [client_Zip] AS qcalc_ClientCSZ,
 [appr_FirstName] & " " & [appr_LastName] AS qcalc_ApprName,
 tbl_Appraisers.appr_Initials,
 tbl_Borrowers.bor_BorrowerName,
 tbl_Borrowers.bor_Address,
 tbl_Borrowers.bor_City,
 tbl_Borrowers.bor_State,
 tbl_Borrowers.bor_Zip,
 tbl_Borrowers.bor_Phone,
 tbl_Borrowers.bor_Fax,
 tbl_Borrowers.bor_Email,
 tbl_Borrowers.bor_Remarks,
 tbl_SaleSources.ssor_SourceDescription,
 tbl_Invoices.inv_RetainerInvoiceDate AS RetainerDate 
 FROM (tbl_Clients 
 INNER JOIN (tbl_Appraisers 
 RIGHT JOIN (((tbl_SaleSources 
 RIGHT JOIN tbl_Jobs 
      ON tbl_SaleSources.ssor_SourceID = tbl_Jobs.job_SaleSourceID) 
 LEFT JOIN tbl_Invoices 
      ON tbl_Jobs.job_JobNumber =tbl_Invoices.inv_JobNumber) 
 LEFT JOIN tbl_Borrowers 
      ON tbl_Jobs.job_JobNumber = tbl_Borrowers.bor_JobNumber) 
      ON tbl_Appraisers.appr_AppraiserID = tbl_Jobs.job_AppraiserID) 
      ON tbl_Clients.client_ClientID = tbl_Jobs.job_ClientID) 
 LEFT JOIN tbl_JobLocations 
      ON tbl_Jobs.job_JobNumber = tbl_JobLocations.jobl_JobNumber 
 ORDER BY tbl_Jobs.job_JobNumber; 

1 个答案:

答案 0 :(得分:3)

您的表单和记录集是否允许添加?您可以通过查看表单底部的导航栏来查看星号(> *)是否显示为灰色。

要打开属性表,请将表单更改为设计视图,然后从菜单中选择View-> Properties。

看看Allow Additions,如果这是No,那么这可能就是答案。将其更改为是并再次检查是否可以更新表单,如果这还没有解决问题,那么......

查看数据选项卡,您将看到记录源 - 这是表单所基于的数据。如果它是查询的名称,请打开查询并查看是否可以向其添加行。如果是sql字符串(SELECT Stuff FROM表),请将其剪切并粘贴为注释。