vba 我收到错误“运行时错误 2105 访问您无法转到指定记录”?请帮我

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3132161/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 11:47:22  来源:igfitidea点击:

I'm getting an Error "runtime error 2105 access you can't go to the specified record"? please help me

ms-accessvbaaccess-vba

提问by A.Vijay

 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

Recordset from comments below

来自下面评论的记录集

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; 

回答by Fionnuala

Does your form and recordset allow additions? You can check this by looking at the navigation bar at the bottom of the form to see if the star (>*) is greyed out.

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

To open the property sheet, change the form to design view and select View->Properties from the menu.

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

Look at Allow Additions, if this is No, then that is probably the answer. Change it to Yes and check again if you can update the form, if this has not fixed the problem then ...

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

Look at the data tab, you will see Record Source - this is the data that the form is based on. If it is the name of a query, open the query and see if you can add a row to it. If it is an sql string (SELECT Stuff FROM table), cut and paste it as a comment.

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