Update statements in practically every SQL dialect does not allow multiple SET commands but only one with multiple expressions separated by commas. Consider doing so and enclosing properly according to data type with quotes (strings), pound signs (dates) or nothing (integer):CurrentDb.Execute "UPDATE WORKED_HOURS " _ & " SET EMPLOYEE_ID=" & Me.cboEmployeeID _ & " , FIRST_NAME='" & Me.FIRST_NAME & "'" _ & " , LAST_NAME='" & Me.LAST_NAME & "'" _ & " , WORK_ORDER_NO='" & Me.cboWorkOrderNo & "'" _ & " , PROJECT_TITLE='" & Me.txtProjectTitle & "'" _ & " , WORKED_DATE=#" & Me.txtWorkedDate & "#" _ & " , TIME_STARTED=#" & Me.txtTimeStarted & "#" _ & " , TIME_FINISHED=#" & Me.txtTimeFinished & "#" _ & " , WEEK_ENDING=#" & Me.txtWeekEnding & "#" _ & " WHERE EMPLOYEE_ID=" & Me.cboEmployeeID.Tag但是为了获得最佳实践,请考虑使用参数化的querydef,它甚至可以避免使用所需的引号或井号. Jet/ACE SQL允许使用PARAMETERS子句声明参数.But for best practices, consider a paramterized querydef which even avoids needed quotes or pound signs. Jet/ACE SQL allows parameter declaration with the PARAMETERS clause.Dim qdef As querydefstrSQL = "PARAMETERS [EMPLOYEE_ID] Integer, [FIRST_NAME] Text(255)," _ & " [LAST_NAME] Text(255), [WORK_ORDER_NO] Text(255)," _ & " [PROJECT_TITLE] Text(255), [WORKED_DATE] Datetime," _ & " [TIME_STARTED] Datetime, [TIME_FINISHED] Datetime," _ & " [WEEK_ENDING] Datetime;" & " UPDATE WORKED_HOURS " _ & " SET EMPLOYEE_ID = [EMPLOYEE_ID]" _ & " , FIRST_NAME = [FIRST_NAME]" _ & " , LAST_NAME = [LAST_NAME] " _ & " , WORK_ORDER_NO = [WORK_ORDER_NO] " _ & " , PROJECT_TITLE = [PROJECT_TITLE]" _ & " , WORKED_DATE = [WORKED_DATE]" _ & " , TIME_STARTED = [TIME_STARTED]" _ & " , TIME_FINISHED = [TIME_FINISHED]" _ & " , WEEK_ENDING = [WEEK_ENDING]" _ & " WHERE EMPLOYEE_ID = [EMPLOYEE_ID]"Set qdef = Currentdb.CreateQueryDef("", strSQL)qdef!EMPLOYEE_ID = Me.cboEmployeeIDqdef!FIRST_NAME = Me.FIRST_NAMEqdef!LAST_NAME = Me.LAST_NAMEqdef!WORK_ORDER_NO = Me.cboWorkOrderNoqdef!PROJECT_TITLE = Me.txtProjectTitleqdef!WORKED_DATE = Me.txtWorkedDateqdef!TIME_STARTED = Me.txtTimeStartedqdef!TIME_FINISHED = Me.txtTimeFinishedqdef!WEEK_ENDING = Me.txtWeekEndingqdef.ExecuteSet qdef = Nothing 这篇关于运行时错误3144的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-18 23:26