我希望我的更新查询只更新表单中的当前记录

时间:2014-06-09 20:20:31

标签: access-vba

我希望我的更新查询只更新表单中的当前记录

这就是我现在所拥有的:

Private Sub Form_AfterUpdate()

DoCmd.RunSQL“UPDATE RO_REALESTATE_AM_PROJECT_STATUS1 INNER JOIN tblEast ON RO_REALESTATE_AM_PROJECT_STATUS1.PROJ_ID = tblEast.RO_REALESTATE_AM_PROJECT_STATUS_PROJ_ID SET RO_REALESTATE_AM_PROJECT_STATUS1.CURRENT_STATUS = [tblEast]![CURRENT_STATUS],RO_REALESTATE_AM_PROJECT_STATUS1.BUDGET_ISSUES = [tblEast]![BUDGET_ISSUES],RO_REALESTATE_AM_PROJECT_STATUS1.SCHEDULE_DELAYS = [ tblEast]![SCHEDULE_DELAYS],RO_REALESTATE_AM_PROJECT_STATUS1.POTENTIAL_ISSUES = [tblEast]![POTENTIAL_ISSUES],RO_REALESTATE_AM_PROJECT_STATUS1.NTP_DESIGN = [tblEast]![RO_REALESTATE_AM_PROJECT_STATUS_NTP_DESIGN],RO_REALESTATE_AM_PROJECT_STATUS1.NTP_CONSTRUCTION = [tblEast]![RO_REALESTATE_AM_PROJECT_STATUS_NTP_CONSTRUCTION],RO_REALESTATE_AM_PROJECT_STATUS1.SUBSTANTIAL_COMPLETION = [tblEast] ![RO_REALESTATE_AM_PROJECT_STATUS_SUBSTANTIAL_COMPLETION],RO_REALESTATE_AM_PROJECT_STATUS1.SCHOOL_OCCUPANCY = [tblEast]![RO_REALESTATE_AM_PROJECT_STATUS_SCHOOL_OCCUPANCY]“

End Sub

这会更新17条记录但我只想更新我的表单中显示的记录。我从组合框中进行选择。 帮助

1 个答案:

答案 0 :(得分:0)

如果这有助于任何人,

这是解决方案

DoCmd.RunSQL“UPDATE RO_REALESTATE_AM_PROJECT_STATUS1 INNER JOIN tblEast ON RO_REALESTATE_AM_PROJECT_STATUS1.PROJ_ID = tblEast.RO_REALESTATE_AM_PROJECT_STATUS_PROJ_ID SET RO_REALESTATE_AM_PROJECT_STATUS1.CURRENT_STATUS = [tblEast]![CURRENT_STATUS],RO_REALESTATE_AM_PROJECT_STATUS1.BUDGET_ISSUES = [tblEast]![BUDGET_ISSUES],RO_REALESTATE_AM_PROJECT_STATUS1.SCHEDULE_DELAYS = [ tblEast]![SCHEDULE_DELAYS],RO_REALESTATE_AM_PROJECT_STATUS1.POTENTIAL_ISSUES = [tblEast]![POTENTIAL_ISSUES],RO_REALESTATE_AM_PROJECT_STATUS1.NTP_DESIGN = [tblEast]![RO_REALESTATE_AM_PROJECT_STATUS_NTP_DESIGN],RO_REALESTATE_AM_PROJECT_STATUS1.NTP_CONSTRUCTION = [tblEast]![RO_REALESTATE_AM_PROJECT_STATUS_NTP_CONSTRUCTION],RO_REALESTATE_AM_PROJECT_STATUS1.SUBSTANTIAL_COMPLETION = [tblEast] ![RO_REALESTATE_AM_PROJECT_STATUS_SUBSTANTIAL_COMPLETION],RO_REALESTATE_AM_PROJECT_STATUS1.SCHOOL_OCCUPANCY = [tblEast]![RO_REALESTATE_AM_PROJECT_STATUS_SCHOOL_OCCUPANCY]其中RO_REALESTATE_AM_PROJECT_STATUS1.PROJ_ID =“& Me.Combo77& “;”