内部连接查询,其中多个where子句链接到多个控件

时间:2015-05-17 17:51:27

标签: access-vba ms-access-2010

构建包含SQL UPDATE语句的字符串时,收到运行时错误2424消息。 Access抱怨其中一个控件或表未被识别。我的直觉告诉我,我的括号或引号有问题。

st_sql = "UPDATE tblCompetency02 INNER JOIN (tblCompetency05 INNER JOIN tblCompetency03 ON tblCompetency05.CompetencyID = tblCompetency03.ID) ON tblCompetency02.ID = tblCompetency03.HighLevelObjective SET tblCompetency05.Checklist = 'YES' WHERE [tblCompetency03].[RoleModelLevel]='self' and [tblCompetency05].[TeamID]= " & Form_frmStaticDataSkills02.TeamID & " and [tblCompetency03].[Order]= " & Form_frmStaticDataSkills02.txtOrder & " and [tblCompetency02].[ID]= " & Form_frmStaticDataSkills02.HLO & ""
Application.DoCmd.RunSQL (st_sql)

Me.TeamIDMe.txtOrderMe.HLO是文本框控件。

1 个答案:

答案 0 :(得分:0)

st_sql = "UPDATE tblCompetency02 INNER JOIN (tblCompetency05 INNER JOIN tblCompetency03 ON tblCompetency05.CompetencyID = tblCompetency03.ID) ON tblCompetency02.ID = tblCompetency03.HighLevelObjective SET tblCompetency05.Checklist = 'YES' WHERE [tblCompetency03].[RoleModelLevel]='self' and [tblCompetency05].[TeamID]= " & Form_frmStaticDataSkills02.TeamID & " and [tblCompetency03].[Order]= " & Form_frmStaticDataSkills02.txtOrder & " and [tblCompetency02].[ID]= " & Form_frmStaticDataSkills02.HLO & ""
Application.DoCmd.RunSQL (st_sql)