我遇到了MS Access 2010的问题,因为有限的24行出现错误“Too many lines continuations”。我目前正在做的是一个项目,在ms访问vb中有超过24行,用于更新表单中的记录。
我已经做过一些研究,但这与我目前正在做的事情无关。如何在ms access vb中取消行的限制?这是示例代码:
更新:
我已经完成了@Andre推荐的操作,但出现了“UPDATE语句中出现语法错误”的错误。有帮助吗?这是更新的代码。
Dim S As String, S1 As String, S2 As String, S3 As String, S4 As String, S5
As String, S6 As String, S7 As String, S8 As String, S9 As String, S10 As
String, S11 As String, S12 As String, S13 As String, S14 As String, S15 As
String, S16 As String, S17 As String, S18 As String, S19 As String
S1 = "Update frm_NTE " & _
" set EHRID = '" & Me.EHRID.Value & "'" & _
",NTEDate = '" & Me.NTEDate.Value & "'"
S2 = ",To = '" & Me.To.Value & "'" & _
",From = '" & Me.From.Value & "'" & _
",DatesWhenActsWasWereCommited = '" & Me.DatesWhenActsWasWereCommited.Value & "'"
S3 = ",DatesWhenActsWasWereDiscovered = '" & Me.DatesWhenActsWasWereDiscovered.Value & "'" & _
",PlacesWhereActsWasWereCommitted = '" & Me.PlacesWhereActsWasWereCommitted.Value & "'" & _
",DetailsOfTheActs = '" & Me.DetailsOfTheActs.Value & "'" & _
",cmdComboListt1 = '" & Me.cmdComboListt1.Value & "'"
S4 = ",Offense = '" & Me.Offense.Value & "'" & _
",ObjectOfViolation = '" & Me.ObjectOfViolation.Value & "'" & _
",ClassPenalty = '" & Me.ClassPenalty.Value & "'" & _
",CorrectiveActionPenalty = '" & Me.CorrectiveActionPenalty.Value & "'"
S5 = ",cmdComboListt2 = '" & Me.cmdComboListt2.Value & "'" & _
",Offense2 = '" & Me.Offense2.Value & "'" & _
",ObjectOfViolation2 = '" & Me.ObjectOfViolation2.Value & "'" & _
",ClassPenalty2 = '" & Me.ClassPenalty2.Value & "'"
S6 = ",CorrectiveActionPenalty2 = '" & Me.CorrectiveActionPenalty2.Value & "'" & _
",cmdComboListt3 = '" & Me.cmdComboListt3.Value & "'" & _
",Offense3 = '" & Me.Offense3.Value & "'" & _
",ObjectOfViolation3 = '" & Me.ObjectOfViolation3.Value & "'"
S7 = ",ClassPenalty3 = '" & Me.ClassPenalty3.Value & "'" & _
",CorrectiveActionPenalty3 = '" & Me.CorrectiveActionPenalty3.Value & "'" & _
",cmdComboListt4 = '" & Me.cmdComboListt4.Value & "'" & _
",Offense4 = '" & Me.Offense4.Value & "'"
S8 = ",ObjectOfViolation4 = '" & Me.ObjectOfViolation4.Value & "'" & _
",ClassPenalty4 = '" & Me.ClassPenalty4.Value & "'" & _
",CorrectiveActionPenalty4 = '" & Me.CorrectiveActionPenalty4.Value & "'" & _
",cmdComboListt5 = '" & Me.cmdComboListt5.Value & "'"
S9 = ",Offense5 = '" & Me.Offense5.Value & "'" & _
",ObjectOfViolation5 = '" & Me.ObjectOfViolation5.Value & "'" & _
",ClassPenalty5 = '" & Me.ClassPenalty5.Value & "'" & _
",CorrectiveActionPenalty5 = '" & Me.CorrectiveActionPenalty5.Value & "'"
S10 = ",cmdComboListt6 = '" & Me.cmdComboListt6.Value & "'" & _
",Offense6 = '" & Me.Offense6.Value & "'" & _
",ObjectOfViolation6 = '" & Me.ObjectOfViolation6.Value & "'" & _
",ClassPenalty6 = '" & Me.ClassPenalty6.Value & "'"
S11 = ",CorrectiveActionPenalty6 = '" & Me.CorrectiveActionPenalty6.Value & "'" & _
",cmdComboListt7 = '" & Me.cmdComboListt7.Value & "'" & _
",Offense7 = '" & Me.Offense7.Value & "'" & _
",ObjectOfViolation7 = '" & Me.ObjectOfViolation7.Value & "'"
S12 = ",ClassPenalty7 = '" & Me.ClassPenalty7.Value & "'" & _
",CorrectiveActionPenalty7 = '" & Me.CorrectiveActionPenalty7.Value & "'" & _
",IssuingManager = '" & Me.IssuingManager.Value & "'" & _
",AuthorizedHRPartner = '" & Me.AuthorizedHRPartner.Value & "'"
S13 = ",ApprovingManager = '" & Me.ApprovingManager.Value & "'" & _
",EmployeeName = '" & Me.EmployeeName.Value & "'" & _
",cmdFunction = '" & Me.cmdFunction.Value & "'" & _
",DateOfReceipt = '" & Me.DateOfReceipt.Value & "'"
S14 = ",TimeOfReceipt = '" & Me.TimeOfReceipt.Value & "'" & _
",EndorsedNTENoticeToHR = '" & Me.EndorsedNTENoticeToHR.Value & "'" & _
",EndorsedNTENoticeToHRLastUser = '" & Me.EndorsedNTENoticeToHRLastUser.Value & "'" & _
",EndorsedNTENoticeToHRLastDateModified = '" & Me.EndorsedNTENoticeToHRLastDateModified.Value & "'"
S15 = ",EndorsedNTENoticeToHRLastTimeModified = '" & Me.EndorsedNTENoticeToHRLastTimeModified.Value & "'" & _
",EndorsementOfNTEToIs = '" & Me.EndorsementOfNTEToIs.Value & "'" & _
",EndorsementOfNTEToISLastUser = '" & Me.EndorsementOfNTEToISLastUser.Value & "'" & _
",EndorsementOfNTEToISLastDateModified = '" & Me.EndorsementOfNTEToISLastDateModified.Value & "'"
S16 = ",EndorsementOfNTEToISLastTimeModified = '" & Me.EndorsementOfNTEToISLastTimeModified.Value & "'" & _
",DateReceivedNTEByTheEmployee = '" & Me.DateReceivedNTEByTheEmployee.Value & "'" & _
",DateReceivedNTEByTheEmployeeLastUser = '" & Me.DateReceivedNTEByTheEmployeeLastUser.Value & "'" & _
",DateReceivedNTEByTheEmployeeLastDateModified = '" & Me.DateReceivedNTEByTheEmployeeLastDateModified.Value & "'"
S17 = ",DateReceivedNTEByTheEmployeeLastTimeModified = '" & Me.DateReceivedNTEByTheEmployeeLastTimeModified.Value & "'" & _
",WrittenExplanationDueDate = '" & Me.WrittenExplanationDueDate.Value & "'" & _
",WrittenExplanationDueDateLastUser = '" & Me.WrittenExplanationDueDateLastUser.Value & "'" & _
",WrittenExplanationDueDateLastDateModified = '" & Me.WrittenExplanationDueDateLastDateModified.Value & "'"
S18 = ",WrittenExplanationDueDateLastTimeModified = '" & Me.WrittenExplanationDueDateLastTimeModified.Value & "'" & _
",SubmissionOfWEtoIS = '" & Me.SubmissionOfWEtoIS.Value & "'" & _
",SubmissionOfWEtoISLastUser = '" & Me.SubmissionOfWEtoISLastUser.Value & "'" & _
",SubmissionOfWEtoISLastDateModified = '" & Me.SubmissionOfWEtoISLastDateModified.Value & "'"
S19 = ",SubmissionOfWEtoISLastTimeModified = '" & Me.SubmissionOfWEtoISLastTimeModified.Value & "'" & _
"Where CaseIDNo = " & Me.CaseIDNo.Value & ""
S = S1 & S2 & S3 & S4 & S5 & S6 & S7 & S8 & S9 & S10 & S11 & S12 & S13 & S14 & S15 & S16 & S17 & S18 & S19
Debug.Print S
CurrentDb.Execute S
答案 0 :(得分:0)
您无法删除该限制...您可以减少新行并缩短行数
(作为插件,您的代码很容易受到SQL注入的影响,但这会属于另一个问题)
答案 1 :(得分:0)
如果你真的必须这样做,请将其分解为多个字符串。
Dim S As String, S1 As String, S2 As String, S3 As String ' ...
S1 = "Update frm_NTE " & _
" set EHRID = '" & Me.EHRID.Value & "'" & _
",DateTodayy = '" & Me.DateTodayy.Value & "'" & _
",EHRID = '" & Me.EHRID.Value & " '"
S2 = ",DateTodayy = '" & Me.DateTodayy.Value & " '" & _
",To = '" & Me.To.Value & " '" & _
",From = '" & Me.From.Value & " '"
' etc. pp.
S = S1 & S2
Debug.Print S
CurrentDb.Execute S
请注意,您有多个& " '"
是拼写错误或错误。或者你想附加空格?