调用填充的表单字段时,MS Access会提示输入参数

时间:2016-03-24 19:01:54

标签: sql ms-access access-vba ms-access-2010

问题: 我有更新查询引用MS Access子表单字段。该字段中有一个值,但Access仍然提示我输入参数。我已经在语句中验证了字段的语法是正确的,并且当我输入参数时查询运行正常,所以我知道我的查询有效。问题是什么?

代码:

  update t_cr_patient_admission_information
      inner join t_cr_committee_apic 
        on t_cr_patient_admission_information.case_nbr = t_cr_committee_apic.case_nbr 
  set t_cr_patient_admission_information.physician_5 = IIf(physician_4 Is Not Null and physician_5 Is Null, t_cr_committee_apic.apic_md_for_review, physician_5),
      t_cr_patient_admission_information.physician_4 = IIf(physician_3 Is Not Null and physician_4 Is Null, t_cr_committee_apic.apic_md_for_review, physician_4), 
      t_cr_patient_admission_information.physician_3 = IIf(physician_2 Is Not Null and physician_3 Is Null, t_cr_committee_apic.apic_md_for_review, physician_3), 
      t_cr_patient_admission_information.physician_2 = IIf(physician_1 Is Not Null and physician_2 Is Null, t_cr_committee_apic.apic_md_for_review, physician_2), 
      t_cr_patient_admission_information.physician_1 = IIf(physician_1 Is Null, apic_md_for_review, physician_1) 
  where [Forms]![frm_existing_case_lookup]![sub_frm_apic_update]![case_code_id] = t_cr_patient_admission_information.case_nbr and t_cr_committee_apic.apic_md_for_review Is Not Null;

1 个答案:

答案 0 :(得分:0)

您需要从子窗体控件引用子窗体:

Forms![frm_existing_case_lookup]![sub_frm_apic_update].Form![case_code_id]

(假设子窗体控件名称也是sub_frm_apic_update

查看Forms: Refer to Form and Subform properties and controls

您需要Forms!Mainform!Subform1.Form!ControlName