我正在尝试使用一个输入框结果来运行两个SQL语句。当我运行它时,我每次都得到输入框。有没有办法显示一次,并在两个语句中使用该单个结果?
result = InputBox("Enter the solicitor name:")
DoCmd.RunSQL ("UPDATE addresses SET sol1=result WHERE sol1 Is Null AND disc1=True;")
DoCmd.RunSQL ("UPDATE addresses SET sol2=result WHERE sol2 Is Null AND disc2=True;")
答案 0 :(得分:0)
您必须连接结果:
DoCmd.RunSQL ("UPDATE addresses SET sol1 = '" & result & "' WHERE sol1 Is Null AND disc1=True;")
允许奥尼尔:
DoCmd.RunSQL ("UPDATE addresses SET sol1 = """ & result & """ WHERE sol1 Is Null AND disc1=True;")