首页 > 解决方案 > 为更新按钮编码时访问 2016 错误 3464

问题描述

在访问 2016 中,我正在尝试使用更新命令。我正在创建一个数据库作为我的实习项目,因为我不熟悉我一直在努力的编码。我指的是 Setha Iech 的视频:https ://www.youtube.com/watch?v=Ri2Y9-16AEo 。当我使用下面的代码时,会不断弹出错误

错误 3464

Private Sub cmdAdd_Click()
    'when we click on button Add there are two options
    '1. for insert
    '2. for update
    If Me.txtID.Tag & "" = "" Then
        'this is for insert new
        'add data to table
        CurrentDb.Execute "INSERT INTO Business(ID, Project_ID, [Date_of_Enquiry], Division, Client, Description, Probability_to_win,Status, [Proposal_Submission_date], [Expected_award_date], Remarks)" & _
                "VALUES ('" & Me.txtID & "','" & Me.txtProject_ID & "','" & Me.txtDate_of_Enquiry & "','" & Me.cboDivision & "','" & _
                Me.txtClient & "','" & Me.txtDescription & "','" & Me.cboProbability_to_win & "','" & Me.cboStatus & "','" & Me.txtProposal_Submission_date & "','" & Me.txtExpected_award_date & "','" & Me.txtRemarks & "')"
    Else
        'otherwise (Tag of txtID store the ID of statement to be modified)
    CurrentDb.Execute "UPDATE Business" & _
    " SET ID=" & Me.txtID & _
    ", Project_ID='" & Me.txtProject_ID & "'" & _
    ", Date_of_Enquiry='" & Me.txtDate_of_Enquiry & "'" & _
    ", Division='" & Me.cboDivision & "'" & _
    ", Client='" & Me.txtClient & "'" & _
    ", Description='" & Me.txtDescription & "'" & _
    ", Probability_to_win='" & Me.cboProbability_to_win & "'" & _
    ", Status='" & Me.cboStatus & "'" & _
    ", Proposal_Submission_date='" & Me.txtProposal_Submission_date & "'" & _
    ", Expected_award_date='" & Me.txtExpected_award_date & "'" & _
    ", Remarks='" & Me.txtRemarks & "'" & _
    " WHERE ID=" & Me.txtID.Tag

    End If


'clear form
cmdClear_Click
'refresh data in list on form
databasesub.Form.Requery

End Sub

提前感谢您的回答

标签: sqlvbams-access

解决方案


推荐阅读